qiboteam / qibocal

Quantum calibration, characterization and validation module for Qibo.
https://qibo.science
Apache License 2.0
28 stars 6 forks source link

Implement validation of parameters across all calibration routines #465

Open aorgazf opened 1 year ago

aorgazf commented 1 year ago

Qibocal needs the infrastructure to be able to check if the parameters extracted from each routine are valid. In addition to the infrastructure, validation rules need to be implemented in all functions:

scarrazza commented 10 months ago

Closing this in favour of #497.

aorgazf commented 2 months ago

Dear @scarrazza, I would like to reopen this issue as, to my knowledge, there is little or no validation of the parameters returned by the characterisation routines in qibocal. In my opinion, validating parameters can be separated from managing the exceptions when the fit fails. Until the control flow is implemented, the routines could at least flag that the fitting failed. This is currently done when the fitting routine throws an exception, but not when the result of the fit does not make sense.

alecandido commented 2 months ago

@aorgazf I'm not sure how you can discriminate a fit that is not failing, but returning bad parameters, from a working one.

The effort is more or less to make the fit extracting the best parameters, and failing if not possible. For some routines, when errors are present, we can raise an error for a too large threshold of the chi2. However, a constant threshold will be hard to define, and there will be a tight trade-off between the false positive and false negative. For other routines, I don't even know how to judge if the parameters are sensible (unless for non-converging fits).

However, we didn't forget about the validation at all. The current effort is to make it simpler for the user to access the result of each routine, and manually process them in Python (cf. #869). If repeated patterns will arise, we will make them part of qibocal itself. But since I'm not yet able to predict which they will be, the only strategy is empowering more the users.

If you already have any concrete example, that would be quite useful to start designing how to integrate more some checks in the routines. Possibly, this feedback may instead help in improving the fits. That would be great as well.