MultiStateClassifier#

Module: exa.core.multistate_classifier.classifier

class MultiStateClassifier#

Bases: object

Implementation of the multi-component three-state classifier.

Attributes

LABEL

The label used as part of the observation name for this classifier.

MODEL_PARAMETERS

The names of the model parameters used by this classifier.

Methods

apply_to_data

Apply classifier to input_data along data_parameters.

calibrate_with_data

Calibrate the classifier for a set of components using labeled data.

get_observation_name

Map component and model parameter to label that is used for retrieving and saving observations.

get_observation_names

Get a list of observation names based on MODEL_PARAMETERS.

get_settings

Get the classifier settings for a set of components.

mitigate_tensor_groups

Apply classifier to input_data along data_parameters.

setting_node_to_parameters

Apply inverse of get_settings.

LABEL = 'multi_state_classifier'#

The label used as part of the observation name for this classifier.

MODEL_PARAMETERS: ClassVar[list[str]] = []#

The names of the model parameters used by this classifier.

component_classifier#

The single component classifier to classify the readout of each individual component.

alias of SingleComponentClassifier

apply_to_data(input_data, settings, component_mapping, override_parameters=None, measure_gate='measure')#

Apply classifier to input_data along data_parameters.

The readout phase is undone only for applying the classifier.

Parameters:
  • input_data (Dataset) – Xarray dataset for which to apply the classifier

  • settings (SettingNode) – Setting trees for the experiment.

  • component_mapping (dict[str, str]) – Dictionary of components and data_variables for which to apply the classifier.

  • override_parameters (dict[str, Any] | None) – Override any parameters that by default are taken from observations

  • measure_gate (str) – The gate used for readout. Defaults to ‘measure’.

Return type:

None

mitigate_tensor_groups(input_data, settings, component_mapping, component_groups, override_parameters=None, measure_gate='measure')#

Apply classifier to input_data along data_parameters.

Parameters:
  • input_data (Dataset) – Xarray dataset for which to apply the classifier

  • settings (SettingNode) – Setting trees for the experiment.

  • component_mapping (dict[str, str]) – Dictionary of components and data_variables for which to apply the classifier.

  • component_groups (list[tuple[str, ...]]) – List of component groups for which to perform the mitigation. The order of components within the group matters!

  • override_parameters (dict[str, Any] | None) – Override any parameters that by default are taken from observations

  • measure_gate (str) – The gate used for readout. Defaults to ‘measure’.

Return type:

None

calibrate_with_data(labeled_input_data, component_mapping, settings, measure_gate='measure')#

Calibrate the classifier for a set of components using labeled data.

Assumes the data be of the form “0…0”: data, “1…1”: data, etc.

Parameters:
  • labeled_input_data (Dataset) – The dataset with labeled calibration data for each component.

  • component_mapping (dict[str, str]) – The map of components to data variables to calibrate the classifier for.

  • settings (SettingNode) – The setting trees for the experiment.

  • measure_gate (str) – The gate used for readout.

Returns:

The mapping of observation names to calibrated model parameters for all components.

Return type:

dict[str, Any]

get_observation_name(parameter)#

Map component and model parameter to label that is used for retrieving and saving observations.

Parameters:

parameter (str) – The name of the model parameter.

Returns:

The observation name for the given parameter.

Return type:

str

get_observation_names()#

Get a list of observation names based on MODEL_PARAMETERS.

Returns:

The observation names for all model parameters.

Return type:

list[str]

get_settings(components)#

Get the classifier settings for a set of components.

Components whose classifier parameters are missing from observations are left out.

Parameters:

components (Iterable) – The components to get the classifier settings for.

Returns:

The setting node containing the classifier model parameters for each component.

Return type:

SettingNode

setting_node_to_parameters(setting_node, components)#

Apply inverse of get_settings.

Parameters:
  • setting_node (SettingNode) – Setting node containing the classifier model parameters for the components.

  • components (Iterable[str]) – The components the setting node contains parameters for.

Returns:

The mapping of observation names to model parameter values.

Return type:

dict[str, Any]

Inheritance

Inheritance diagram of exa.core.multistate_classifier.classifier.MultiStateClassifier