MultiStateClassifier#
Module: exa.core.multistate_classifier.classifier
- class MultiStateClassifier#
Bases:
objectImplementation of the multi-component three-state classifier.
Attributes
The label used as part of the observation name for this classifier.
The names of the model parameters used by this classifier.
Methods
Apply classifier to input_data along data_parameters.
Calibrate the classifier for a set of components using labeled data.
Map component and model parameter to label that is used for retrieving and saving observations.
Get a list of observation names based on MODEL_PARAMETERS.
Get the classifier settings for a set of components.
Apply classifier to input_data along data_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:
- get_observation_name(parameter)#
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(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:
- setting_node_to_parameters(setting_node, components)#
Apply inverse of get_settings.
Inheritance
