-
Notifications
You must be signed in to change notification settings - Fork 66
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
Rework the NoiseModel interface #697
Comments
Thanks a lot for this neat description! As you described in change 2., just from a runtime perspective, users still need a way to toggle noise channels afterwards if a parameter is bound to several. Having two methods to call successively seems the most natural, like An alternate possibility could be to not bind any parameter to more than 1 noise channel. So you would have a |
Thank you for your insights! I think we agree that there is no perfect solution for this case. |
There are few issues with the existing
NoiseModel
interface:Cumbersome UX: When activating a set of noises, they have to be given to the
noise_types
argument and the corresponding parameters have to be modified from their defaults. For example, to include only a 10% rate of false positives, one needs to defineNoiseModel(noise_types=("SPAM",), p_false_pos=0.1, p_false_neg=0., state_prep_error=0.)
. Preferably, one should only need to defineNoiseModel(p_false_pos=0.1)
.Error-prone: In fact, the "preferred way" shown above seems to be something users are intuitively doing already and it currently results in no noise being actually included, which is admittedly misleading.
Arbitrary/misleading default values: The default values for every parameter where inherited from the
SimConfig
class, which was created in a time where providing reasonable defaults was needed. Now that we can associate default noise models to devices, keeping some universal default values makes much less sense. Furthermore, having non-zero default values is an issue in itself, since it includes noise through parameters the user never explicitly defined.Confusing
__repr__()
: As a consequence of having all these default values, theNoiseModel.__repr__()
(autogenerated becauseNoiseModel
is a dataclass) is a confusing mess of default values.Proposed changes:
Deprecate the default values: We can't just change them because it will break existing code (or worse, silently change the results). However, we can deprecate them and mark them for removal in v1.
Not requiring the explicit definition of
noise_types
: Instead of relying on the user "activating" the noises they want, we can move to an interface where they just specify the parameters that should be taken into account and the corresponding noise type is internally "activated". For now this will work well because each noise parameter is associated to a unique noise type. However, I can see at some point a parameter liketemperature
being associated to more than one noise type (eg. Doppler noise and thermal motion of the atoms). In this case, having the desired noise type(s) explicitly defined would be needed for finer control, so I don't think we can completely move away from explicit noise type definition. Nonetheless, we can still make it an optional parameter that is generally not required.Define a custom
__repr__()
: We can make it so only the active noises and associated parameters appear.The text was updated successfully, but these errors were encountered: