pygsti.drivers.bootstrap

Functions for generating bootstrapped error bars

Module Contents

Functions

create_bootstrap_dataset(input_data_set, generation_method)

Creates a DataSet used for generating bootstrapped error bars.

create_bootstrap_models(num_models, input_data_set, ...)

Creates a series of "bootstrapped" Models.

gauge_optimize_models(gs_list, target_model[, ...])

Optimizes the "spam weight" parameter used when gauge optimizing a set of models.

pygsti.drivers.bootstrap.create_bootstrap_dataset(input_data_set, generation_method, input_model=None, seed=None, outcome_labels=None, verbosity=1)

Creates a DataSet used for generating bootstrapped error bars.

Parameters

input_data_setDataSet

The data set to use for generating the “bootstrapped” data set.

generation_method{ ‘nonparametric’, ‘parametric’ }

The type of dataset to generate. ‘parametric’ generates a DataSet with the same circuits and sample counts as input_data_set but using the probabilities in input_model (which must be provided). ‘nonparametric’ generates a DataSet with the same circuits and sample counts as input_data_set using the count frequencies of input_data_set as probabilities.

input_modelModel, optional

The model used to compute the probabilities for circuits when generation_method is set to ‘parametric’. If ‘nonparametric’ is selected, this argument must be set to None (the default).

seedint, optional

A seed value for numpy’s random number generator.

outcome_labelslist, optional

The list of outcome labels to include in the output dataset. If None are specified, defaults to the spam labels of input_data_set.

verbosityint, optional

How verbose the function output is. If 0, then printing is suppressed. If 1 (or greater), then printing is not suppressed.

Returns

DataSet

pygsti.drivers.bootstrap.create_bootstrap_models(num_models, input_data_set, generation_method, fiducial_prep, fiducial_measure, germs, max_lengths, input_model=None, target_model=None, start_seed=0, outcome_labels=None, lsgst_lists=None, return_data=False, verbosity=2)

Creates a series of “bootstrapped” Models.

Models are created from a single DataSet (and possibly Model) and are typically used for generating bootstrapped error bars. The resulting Models are obtained by performing MLGST on data generated by repeatedly calling create_bootstrap_dataset() with consecutive integer seed values.

Parameters

num_modelsint

The number of models to create.

input_data_setDataSet

The data set to use for generating the “bootstrapped” data set.

generation_method{ ‘nonparametric’, ‘parametric’ }

The type of data to generate. ‘parametric’ generates DataSets with the same circuits and sample counts as input_data_set but using the probabilities in input_model (which must be provided). ‘nonparametric’ generates DataSets with the same circuits and sample counts as input_data_set using the count frequencies of input_data_set as probabilities.

fiducial_preplist of Circuits

The state preparation fiducial circuits used by MLGST.

fiducial_measurelist of Circuits

The measurement fiducial circuits used by MLGST.

germslist of Circuits

The germ circuits used by MLGST.

max_lengthslist of ints

List of integers, one per MLGST iteration, which set truncation lengths for repeated germ strings. The list of circuits for the i-th LSGST iteration includes the repeated germs truncated to the L-values up to and including the i-th one.

input_modelModel, optional

The model used to compute the probabilities for circuits when generation_method is set to ‘parametric’. If ‘nonparametric’ is selected, this argument must be set to None (the default).

target_modelModel, optional

Mandatory model to use for as the target model for MLGST when generation_method is set to ‘nonparametric’. When ‘parametric’ is selected, this should be the ideal version of input_model.

start_seedint, optional

The initial seed value for numpy’s random number generator when generating data sets. For each succesive dataset (and model) that are generated, the seed is incremented by one.

outcome_labelslist, optional

The list of Outcome labels to include in the output dataset. If None are specified, defaults to the effect labels of input_data_set.

lsgst_listslist of circuit lists, optional

Provides explicit list of circuit lists to be used in analysis; to be given if the dataset uses “incomplete” or “reduced” sets of circuit. Default is None.

return_databool

Whether generated data sets should be returned in addition to models.

verbosityint

Level of detail printed to stdout.

Returns

modelslist

The list of generated Model objects.

datalist

The list of generated DataSet objects, only returned when return_data == True.

pygsti.drivers.bootstrap.gauge_optimize_models(gs_list, target_model, gate_metric='frobenius', spam_metric='frobenius', plot=True)

Optimizes the “spam weight” parameter used when gauge optimizing a set of models.

This function gauge optimizes multiple times using a range of spam weights and takes the one the minimizes the average spam error multiplied by the average gate error (with respect to a target model).

Parameters

gs_listlist

The list of Model objects to gauge optimize (simultaneously).

target_modelModel

The model to compare the gauge-optimized gates with, and also to gauge-optimize them to.

gate_metric{ “frobenius”, “fidelity”, “tracedist” }, optional

The metric used within the gauge optimization to determing error in the gates.

spam_metric{ “frobenius”, “fidelity”, “tracedist” }, optional

The metric used within the gauge optimization to determing error in the state preparation and measurement.

plotbool, optional

Whether to create a plot of the model-target discrepancy as a function of spam weight (figure displayed interactively).

Returns

list

The list of Models gauge-optimized using the best spamWeight.