mlrl.testbed.experiments.input.sources package¶
Author Michael Rapp (michael.rapp.ml@gmail.com)
Provides classes that allow to read input data from different sources.
- class mlrl.testbed.experiments.input.sources.CsvFileSource(directory: Path)¶
Bases:
TabularFileSourceAllows to read tabular input data from a CSV file.
- DELIMITER = ','¶
- QUOTE_CHAR = '"'¶
- SUFFIX_CSV = 'csv'¶
- class mlrl.testbed.experiments.input.sources.FileSource(directory: Path, suffix: str)¶
-
An abstract base class for all sources that read input data from a file.
- is_available(state: ExperimentState, input_data: InputData) bool¶
Must be implemented by subclasses in order to check whether input data is available or not.
- Parameters:
state – The state that should be used to store the input data
input_data – The input data that should be read
- Returns:
True, if the input data is available, False otherwise
- read_from_source(state: ExperimentState, input_data: InputData) bool¶
Must be implemented by subclasses in order to read input data from the source.
- Parameters:
state – The state that should be used to store the input data
input_data – The input data that should be read
- Returns:
True, if any input data has been read, False otherwise
- class mlrl.testbed.experiments.input.sources.PickleFileSource(directory: Path)¶
Bases:
FileSourceAllows to read input data from a file using Python’s pickle mechanism.
- SUFFIX_PICKLE = 'pickle'¶
- class mlrl.testbed.experiments.input.sources.Source¶
Bases:
ABCAn abstract base class for all sources, input data may be read from.
- abstractmethod is_available(state: ExperimentState, input_data: InputData) bool¶
Must be implemented by subclasses in order to check whether input data is available or not.
- Parameters:
state – The state that should be used to store the input data
input_data – The input data that should be read
- Returns:
True, if the input data is available, False otherwise
- abstractmethod read_from_source(state: ExperimentState, input_data: InputData) bool¶
Must be implemented by subclasses in order to read input data from the source.
- Parameters:
state – The state that should be used to store the input data
input_data – The input data that should be read
- Returns:
True, if any input data has been read, False otherwise
- class mlrl.testbed.experiments.input.sources.TextFileSource(directory: Path)¶
Bases:
TextualFileSourceAllows to read textual input data from a text file.
- SUFFIX_TEXT = 'txt'¶
- class mlrl.testbed.experiments.input.sources.YamlFileSource(directory: Path, schema_file_path: Path | None = None)¶
Bases:
StructuralFileSourceAllows to read structural input data from a YAML file.
- SUFFIX_YAML = 'yml'¶