Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade primitive result dataclasses #8100

Closed
Tracked by #8890
pedrorrivero opened this issue May 23, 2022 · 3 comments
Closed
Tracked by #8890

Upgrade primitive result dataclasses #8100

pedrorrivero opened this issue May 23, 2022 · 3 comments
Labels
mod: primitives Related to the Primitives module type: feature request New feature or request

Comments

@pedrorrivero
Copy link
Member

pedrorrivero commented May 23, 2022

What should we add?

In the context of EstimatorResult:

  • Rename values field, for expvals. The former is not only too generic but also misleading (i.e. reminds of key-value pairs), whereas the latter is specific to statistics and directly relatable to quantum mechanics.
  • Add a variances field, pulling it out of metadata. Since the result that we provide is statistical in nature, variances should have better exposure and be enforced. If calculating exact expectation values using a simulator, individual variances can always be set to zero.
  • Use core python types instead of numpy (e.g. tuple). The EstimatorResult data structure is not related to numpy in any straightforward way, so returning ndarray seems unwarranted; since that is a mainly operational data type and what we really want here is data exchange, not performing fancy operations like vector addition. Users that need numpy can always cast.
  • Use tuple instead of list for metadata. Lists are mutable, and the dataclass has frozen=True, which seems contradictory. This should also be taken into account in the previous request to remove numpy data types.
@pedrorrivero pedrorrivero added the type: feature request New feature or request label May 23, 2022
@pedrorrivero pedrorrivero changed the title Upgrade EstiamtorResult class Upgrade EstiamtorResult dataclass May 23, 2022
@pedrorrivero pedrorrivero changed the title Upgrade EstiamtorResult dataclass Upgrade EstimatorResult dataclass May 23, 2022
@Cryoris
Copy link
Contributor

Cryoris commented May 25, 2022

Adding variances is a good idea 👍🏻

About renaming values to expvals: I think we're not really using abbreviations anywhere in the user-facing interfaces but typically tend write the full word, so expvals is not really fitting this scheme. I personally think values is clear enough since it's an attribute on the estimator. But if you think it's not clear enough maybe we can use expectation_values (which gets a bit long though)?

@pedrorrivero
Copy link
Member Author

pedrorrivero commented May 25, 2022

Yes, I was first considering expectation_values, and also thought it was kind of long @Cryoris .

My main issue with values is that it is kind of vague. In statistics there are estimators for the variance (e.g. Bessel's), so just using the word "value" does not feel specific enough. What value? On top of that, but certainly less important, it can cause confusion with key-value pairs in a dictionary.

Maybe expvals is not the right name, but I think it would be nice to think of a more descriptive alternative. I am open to suggestions!

UPDATE: expectation_values seems to be receiving good feedback. Other alternatives are expectations and means.

@pedrorrivero pedrorrivero mentioned this issue Oct 13, 2022
29 tasks
@pedrorrivero pedrorrivero changed the title Upgrade EstimatorResult dataclass Upgrade primitive result dataclasses Oct 13, 2022
@woodsp-ibm woodsp-ibm added the mod: primitives Related to the Primitives module label Oct 13, 2022
@t-imamichi
Copy link
Member

I close this because the discussion is obsolete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod: primitives Related to the Primitives module type: feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants