pygsti.algorithms.germselection.compute_germ_set_score#
- compute_germ_set_score(germs, target_model=None, neighborhood=None, neighborhood_size=5, randomization_strength=0.01, score_func='all', op_penalty=0.0, l1_penalty=0.0, num_nongauge_params=None, float_type=None, gate_penalty=None)#
Calculate the score of a germ set with respect to a model.
More precisely, this function computes the maximum score (roughly equal to the number of amplified parameters) for a cloud of models. If target_model is given, it serves as the center of the cloud, otherwise the cloud must be supplied directly via neighborhood.
- Parameters:
germs (list) – The germ set
target_model (Model, optional) – The target model, used to generate a neighborhood of randomized models.
neighborhood (list of Models, optional) – The “cloud” of models for which scores are computed. If not None, this overrides target_model, neighborhood_size, and randomization_strength.
neighborhood_size (int, optional) – Number of randomized models to construct around target_model.
randomization_strength (float, optional) – Strength of unitary randomizations, as passed to
target_model.randomize_with_unitary().score_func ({'all', 'worst'}) – Sets the objective function for scoring the eigenvalues. If ‘all’, score is
sum(1/input_array). If ‘worst’, score is1/min(input_array).op_penalty (float, optional) – Coefficient for a penalty linear in the sum of the germ lengths.
l1_penalty (float, optional) – Coefficient for a penalty linear in the number of germs.
num_nongauge_params (int, optional) – Force the number of nongauge parameters rather than rely on automated gauge optimization.
float_type (numpy dtype object, optional) – Numpy data type to use for floating point arrays.
gate_penalty (dict, optional (default None)) – An optional dictionary allowing the specification of gate-specific penalties to add for each instance of the specified gate(s) in each germ. Should be specified as a dictionary whose keys are strings corresponding to gate names, and whose values are the penalty factor to add for each instance of that gate. E.g. {‘Gcnot’:2} would correspond to a penalty term where each instance of a ‘Gcnot’ gate gets and additional 2 units added to the cost function for a candidate germ.
- Returns:
The maximum score for germs, indicating how many parameters it amplifies.
- Return type: