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

Drop dependency on uncertainties #1327

Open
nkanazawa1989 opened this issue Nov 21, 2023 · 0 comments
Open

Drop dependency on uncertainties #1327

nkanazawa1989 opened this issue Nov 21, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@nkanazawa1989
Copy link
Collaborator

Suggested feature

Qiskit Experiments uses uncertainties package for computing error propagation. This package provides UFloat object consisting of two values representing nominal part and standard error. It also offers numpy ufunc wrapper uncertainties.unumpy that computes numpy function with UFloat values with automatic error propagation. Correlation of values are also considered, which prevent us from overestimating the variance due to missing correlation (e.g. when we obtain multiple parameters from a single curve fitting, the values are usually correlated -- covariance).

This dependency was first introduced in #481 , and mainly used for curve analysis module.

  • Data processor considers error propagation to compute the variance of measurement value. This variance is used as weights in the fitter, and also considered to output the fit parameters. The fit parameters are presented by UFloat object.
  • Some analysis classes consider error propagation. For example, CrossResonanceHamiltonianAnalysis computes CR Hamiltonian coefficients by digesting two fit parameters from statistically independent fits.
  • Curve analysis plots 1 and 3 sigma area along with the fit curves (shown by filled area). This area is very accurate because fit parameter correlation is considered.

However, it's probably difficult to continue to rely on this package because of the following reasons:

  • This package has not been maintained in recent years, and there could be potential security vulnerability risks and future dependency incompatibility with our package.
  • Value correlation information is missing after serialization (i.e. saving experiment data), because error correlation is managed by Python object ID, and random object ID is assigned after we deserialize the saved quantities; when we compute new value by using two or more fit parameters loaded from database, variance could be overestimated due to missing correlation info. This is not really practically useful in our framework.
  • Lastly (more importantly), accurate computation of error propagation introduces visible performance bottleneck. In addition, UFloat object is not compatible with JAX framework, which eventually conflict with performant JAX fitter which is currently under development (see Overhaul Qiskit Experiments (RFC0014) #1268).

As far as I know, we don't have good alternative to this package (well maintained, multiple-platform support, compatible software license). Considering the current use case of this package, I don't think accuracy of standard error is quite important.

  • We can consider sampling error without relying on uncertainties package. Out fitter doesn't use unumpy functions.
  • Number of analysis classes which calculate values from multiple fit parameters are limited. We can manually manage error propagation.
  • I don't think 1 and 3 sigma area in the curve image is very important (especially in 1000 qubit era we cannot check every image data). We can just plot fit lines.
@nkanazawa1989 nkanazawa1989 added the enhancement New feature or request label Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant