You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the depolarize model method with an H-only error model and specifying only the value of the spam_noise kwarg the method quietly fails. The H-only part is almost certainly a red herring, as in general the expectation would be that this should loudly fail for any error generator parameterized SPAM operation, as is the case for operations. We should either a) finally go ahead and implement the depolarize method for SPAM (at which point we can add checks for whether it possible to depolarize the model given the available error generator parameters) or b) add some checks to ComposedState (and probably ComposedEffect) like what are present for ComposedOp. Bookmarking this issue for a future fix.
To Reproduce
The code below will reproduce this behavior. The H-only part shouldn't be necessary to reproduce this (but that is the context in which I stumbled into this, so it is reflected in the copypasta below).
from pygsti.modelpacks import smq1Q_XY
target_model = smq1Q_XY.target_model('H')
depolarized_model = target_model.depolarize(spam_noise=1e-3)
Since this is an H-only model we can't depolarize it, but it does nothing silently. If we instead had set the op_noise kwarg in the depolarize call above it would have raised the following exception:
ValueError: Cannot set the value of a ComposedOp directly!
Environment (please complete the following information):
pyGSTi version 0.9.12
python version 3.9
Additional context
Some context for how I ran into this. There are a few places in the code where we need to regularize an input model for some particular calculation, and one of those is in computing the fisher information (which divides by probabilities at one point). So, by default the first thing the fisher information code does is add a small amount of depolarization to the SPAM. I had forgotten about this when doing some fisher information calculations on an H-only error model and ran into some divide-by-zero errors. After being first confused about why I was getting these when the regularization was turned on, and then face-palming when I realized that this of course does nothing on an H-only error model, I then found myself confused at the fact that an exception wasn't raised.
Computing Fisher information for various reduced models is something we want to do fairly regularly, so we should look into the proper way to manage regularization for reduced models. For this particular case I am going to manually regularize this by adding in a small unitary perturbation (if anyone thinks that is a bad idea in the context of Fisher info let me know), but it would be good to figure out a general scheme.
The text was updated successfully, but these errors were encountered:
When using the
depolarize
model method with an H-only error model and specifying only the value of thespam_noise
kwarg the method quietly fails. The H-only part is almost certainly a red herring, as in general the expectation would be that this should loudly fail for any error generator parameterized SPAM operation, as is the case for operations. We should either a) finally go ahead and implement the depolarize method for SPAM (at which point we can add checks for whether it possible to depolarize the model given the available error generator parameters) or b) add some checks toComposedState
(and probablyComposedEffect
) like what are present forComposedOp
. Bookmarking this issue for a future fix.To Reproduce
The code below will reproduce this behavior. The H-only part shouldn't be necessary to reproduce this (but that is the context in which I stumbled into this, so it is reflected in the copypasta below).
Since this is an H-only model we can't depolarize it, but it does nothing silently. If we instead had set the
op_noise
kwarg in thedepolarize
call above it would have raised the following exception:ValueError: Cannot set the value of a ComposedOp directly!
Environment (please complete the following information):
Additional context
Some context for how I ran into this. There are a few places in the code where we need to regularize an input model for some particular calculation, and one of those is in computing the fisher information (which divides by probabilities at one point). So, by default the first thing the fisher information code does is add a small amount of depolarization to the SPAM. I had forgotten about this when doing some fisher information calculations on an H-only error model and ran into some divide-by-zero errors. After being first confused about why I was getting these when the regularization was turned on, and then face-palming when I realized that this of course does nothing on an H-only error model, I then found myself confused at the fact that an exception wasn't raised.
Computing Fisher information for various reduced models is something we want to do fairly regularly, so we should look into the proper way to manage regularization for reduced models. For this particular case I am going to manually regularize this by adding in a small unitary perturbation (if anyone thinks that is a bad idea in the context of Fisher info let me know), but it would be good to figure out a general scheme.
The text was updated successfully, but these errors were encountered: