-
Notifications
You must be signed in to change notification settings - Fork 57
WIP: TVD and other objectives in GST #649
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
base: develop
Are you sure you want to change the base?
Conversation
…me a file in test/performance so that it doesnt get discovered by testing frameworks like pytest
…t commit will simpify further, which may have consequences from the perspective of floating point arithmetic. Checking in NOW in case we want to revert to this version for numerical reasons.
…eparately, modify docstring for run_long_sequence_gst to be consistent with its implementation (including leaving notes for later).
…uge_group. Having the casting occur here makes sense, since a model has access to the associated StateSpace, Basis, and Evotype.
…tchboard.objfn_builder was used when switchboard.objfn_builder_modvi should have been used
…nse of being possibly-incorrect
…ectiveFunction with an implementation that works for five of its eight derived classes. Removed the separate implementations for those five derived classes. Introduce a templated docstring for TimeIndependentMDCObjectiveFunction and a decorator to reduce duplication among the nine total __init__ functions of this class and its eight derived classes .
…uilders has no derived classes.
… setting a module-level variable
…option of preserving parameterization. I set the default to False, since this seems to be needed for existing germ selection tests.
… if the model is serialized then it can be deserialized correctly.
…e a collision that puts correctness at risk
…be near zero for correctness. Tests now pass even when optools.py.__SCALAR_TOL_EXPONENT__ = -1, which is reasonable to set when trying to suppress warnings or certain errors
…when (de)serializing a model with gate labels like `GCNOT` and `GIX`"
…nges needed for test_gaugeopt_correctness.
interp_weights[interp_weights < p] = 0.0 | ||
interp_weights[interp_weights > 0] = 1.0 | ||
else: | ||
interp_weights = p * _np.ones(num_circuits) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we allowing p
to be a arraylike here, so that one can fully specify the distribution of weights?
objective : {'logl', 'chi2', 'tvd'}, optional | ||
Whether to create builders for maximum-likelihood or minimum-chi-squared GST. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment needs to be updated to include total variational distance GST.
import warnings | ||
warnings.warn(f'Trying to create an objective function from non-string specification, "{objective}". \ | ||
\nSupport for this kind of specification is experimental!') | ||
iteration_builders = [chi2_builder] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not need line 796.
switchboard.modvi_ds, switchboard.mdl_final_modvi, | ||
switchboard.objfn_builder_modvi, | ||
switchboard.circuits_final, | ||
switchboard.modvi_ds, switchboard.mdl_current_modvi, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switchboard.mdl_current_modvi
seems inaccurate. This function is for the final_model_fit. Thus, shouldn't the appropriate model be switchboard.mdl_final_modvi
?
@@ -99,6 +110,18 @@ def assert_hermitian(mat): | |||
assert_hermitian(a) | |||
assert_hermitian(b) | |||
|
|||
def check_unit_trace(mat): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want check_unit_trace
to be only callable within _flat_mut_blks
?
that we never reference in the code (truncScheme, estimate_label, and | ||
missingDataAction). | ||
|
||
- objective = typically, a string in {'chi2', 'logl', 'tvd'}. But this can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the Literal
typing to the parameter objective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These arguments are only passed in the advanced_options dict. I can add the type annotation that advanced_options is dict[str,Any]
. I'll leave other type annotations of this function to later work.
def create_from(cls, objective='logl', freq_weighted_chi2=False): | ||
# This was a classmethod, but I made it static because this class has no derived classes. | ||
@staticmethod | ||
def create_from(objective='logl', freq_weighted_chi2=False, callable_penalty=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
objective
should be typed as a Literal
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some items for consideration.
pygsti/layouts/copalayout.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed to make these changes to resolve exceptions that were getting raised. I need to find an example showing how to trigger the error without these changes.
…of a TypeError from CircuitOutcomeProbabilityArrayLayout.indices_and_outcomes_for_index)
…ityArrayLayout.__iter__ (needed to convert slice to iterable)
Notes to self (updated sporadically):