pygsti.protocols.confidenceregionfactory.ConfidenceRegionFactoryView#
- class ConfidenceRegionFactoryView(model, inv_projected_hessian, mlgst_params, confidence_level, non_mark_radius_sq, n_non_gauge_params, n_gauge_params)#
Bases:
objectEncapsulates a lightweight “view” of a ConfidenceRegionFactory.
A view object is principally defined by it’s having a fixed confidence-level. Thus, a “view” is like a factory that generates confidence intervals for just a single confidence level. As such, it is a useful object to pass around to routines which compute and display error bars, as these routines typically don’t depend on what confidence-level is being used.
- Parameters:
model (Model) – The model at the center of this confidence region.
inv_projected_hessian (numpy.ndarray) – The computed inverse of the non-gauge-projected Hessian.
mlgst_params (dict) – A dictionary of ML-GST parameters only used for linear-response error bars.
confidence_level (float) – the confidence level (between 0 and 100) used in the computation of confidence regions/intervals.
non_mark_radius_sq (float, optional) – When non-zero, “a non-Markovian error region” is constructed using this value as the squared “non-markovian radius”. This specifies the portion of 2*(max-log-likelihood - model-log-likelihood) that we attribute to non-Markovian errors (typically the previous difference minus it’s expected value, the difference in number of parameters between the maximal and model models). If set to zero (the default), a standard and thereby statistically rigorous conficence region is created. Non-zero values should only be supplied if you really know what you’re doing.
n_non_gauge_params (int) – The numbers of non-gauge parameters. This could be computed from model but can be passed in to save computational time.
n_gauge_params (int) – The numbers of gauge parameters. This could be computed from model but can be passed in to save computational time.
Creates a new ConfidenceRegionFactoryView.
Usually this constructor is not called directly, and objects of this type are obtained by calling the
view()method of a ConfidenceRegionFactory object.- Parameters:
model (Model) – The model at the center of this confidence region.
inv_projected_hessian (numpy.ndarray) – The computed inverse of the non-gauge-projected Hessian.
mlgst_params (dict) – A dictionary of ML-GST parameters only used for linear-response error bars.
confidence_level (float) – the confidence level (between 0 and 100) used in the computation of confidence regions/intervals.
non_mark_radius_sq (float, optional) – When non-zero, “a non-Markovian error region” is constructed using this value as the squared “non-markovian radius”. This specifies the portion of 2*(max-log-likelihood - model-log-likelihood) that we attribute to non-Markovian errors (typically the previous difference minus it’s expected value, the difference in number of parameters between the maximal and model models). If set to zero (the default), a standard and thereby statistically rigorous conficence region is created. Non-zero values should only be supplied if you really know what you’re doing.
n_non_gauge_params (int) – The numbers of non-gauge and gauge parameters, respectively. These could be computed from model but they’re passed in to save computational time.
n_gauge_params (int) – The numbers of non-gauge and gauge parameters, respectively. These could be computed from model but they’re passed in to save computational time.
Methods
__init__(model, inv_projected_hessian, ...)Creates a new ConfidenceRegionFactoryView.
compute_confidence_interval(fn_obj[, eps, ...])Compute the confidence interval for an arbitrary function.
compute_grad_f(fn_obj, f0, nParams[, eps])Retrieve the profile-likelihood confidence intervals for a specified model object (or all such intervals).
Attributes
Return the type of error bars this view will generate, either "standard" or "non-markovian".
- compute_confidence_interval(fn_obj, eps=1e-07, return_fn_val=False, verbosity=0)#
Compute the confidence interval for an arbitrary function.
This “function”, however, must be encapsulated as a ModelFunction object, which allows it to neatly specify what its dependencies are and allows it to compaute finite- different derivatives more efficiently.
- Parameters:
fn_obj (ModelFunction) – An object representing the function to evaluate. The returned confidence interval is based on linearizing this function and propagating the model-space confidence region.
eps (float, optional) – Step size used when taking finite-difference derivatives of fnOfOp.
return_fn_val (bool, optional) – If True, return the value of fnOfOp along with it’s confidence region half-widths.
verbosity (int, optional) – Specifies level of detail in standard output.
- Returns:
df (float or numpy array) – Half-widths of confidence intervals for each of the elements in the float or array returned by fnOfOp. Thus, shape of df matches that returned by fnOfOp.
f0 (float or numpy array) – Only returned when return_fn_val == True. Value of fnOfOp at the gate specified by op_label.
- retrieve_profile_likelihood_confidence_intervals(label=None, component_label=None)#
Retrieve the profile-likelihood confidence intervals for a specified model object (or all such intervals).
- Parameters:
label (Label, optional) – If not None, can be either a gate or SPAM vector label to specify the confidence intervals corresponding to gate, rhoVec, or EVec parameters respectively. If None, then intervals corresponding to all of the model’s parameters are returned.
component_label (Label, optional) – Labels an effect within a POVM or a member within an instrument.
- Returns:
One-dimensional array of (positive) interval half-widths which specify a symmetric confidence interval.
- Return type:
numpy array
- property errorbar_type#
Return the type of error bars this view will generate, either “standard” or “non-markovian”.
- Return type:
str