mlrl.testbed.experiments.state module¶
Author: Michael Rapp (michael.rapp.ml@gmail.com)
Provides classes for representing the state of experiments.
- class mlrl.testbed.experiments.state.ExperimentMode(*values)¶
Bases:
StrEnumRepresents the mode of operation.
- BATCH = 'batch'¶
- READ = 'read'¶
- RUN = 'run'¶
- SINGLE = 'single'¶
- class mlrl.testbed.experiments.state.ExperimentState(mode: ExperimentMode, args: Namespace, meta_data: MetaData, problem_domain: ProblemDomain, folding_strategy: FoldingStrategy | None = None, dataset_type: DatasetType = DatasetType.TRAINING, dataset: Any | None = None, fold: Fold | None = None, parameters: dict[str, ~typing.Any]=<factory>, training_result: TrainingState | None = None, prediction_result: PredictionState | None = None, extras: dict[str, ~typing.Any]=<factory>)¶
Bases:
objectRepresents the state of an experiment.
- Attributes:
mode: The mode of operation args: The command line argument that have been used to start the experiment meta_data: Meta-data about the command that has been used for running the experiment problem_domain: The problem domain, the experiment is concerned with folding_strategy: The strategy that is used for creating different folds of the dataset during the experiment dataset_type: The type of the dataset used in the experiment dataset: The dataset used in the experiment or None, if no dataset has been loaded yet fold: The current fold of the dataset or None, if the state does not correspond to a specific fold parameters: Algorithmic parameters of the learner used in the experiment training_result: The result of the training process or None, if no model has been trained yet prediction_result: The result of the prediction process or None, if no predictions have been obtained yet extras: A dictionary that can be used to store arbitrary data referenced via a unique key
- dataset_as(*types: type[Any]) Any | None¶
Returns the dataset used in the experiment, if it has one of given types. Otherwise, a log message is omitted and None is returned.
- Parameters:
types – The accepted types
- Returns:
The dataset or None, if it does not have the correct type
- dataset_type: DatasetType = 'training'¶
- folding_strategy: FoldingStrategy | None = None¶
- learner_as(*types: type[Any]) Any | None¶
Returns the learner that has been trained in the experiment, if it has one of given types. Otherwise, a log message is omitted and None is returned.
- Parameters:
types – The accepted types
- Returns:
The learner or None, if it does not have the correct type
- mode: ExperimentMode¶
- prediction_result: PredictionState | None = None¶
- problem_domain: ProblemDomain¶
- training_result: TrainingState | None = None¶
- class mlrl.testbed.experiments.state.PredictionResult(predictions: Any, prediction_type: PredictionType, prediction_duration: Duration)¶
Bases:
objectStores the result of a prediction process.
- Attributes:
predictions: A numpy.ndarray, scipy.sparse.spmatrix or scipy.sparse.sparray storing predictions prediction_type: The type of the predictions prediction_duration: The time needed for prediction
- prediction_type: PredictionType¶
- class mlrl.testbed.experiments.state.PredictionState(prediction_scope: PredictionScope, prediction_result: PredictionResult | None = None)¶
Bases:
objectRepresents the result of a prediction process.
- Attributes:
prediction_scope: Whether the predictions have been obtained from a global model or incrementally prediction_result: The result of the prediction process, if available
- prediction_result: PredictionResult | None = None¶
- prediction_scope: PredictionScope¶