minto.v1.exp_dataspace
Classes¶
Space¶
Space()Enumeration defining the types of spaces in the experiment data structure.
ExperimentDataSpace¶
ExperimentDataSpace(experiment_name: str, experiment_datastore: minto.v1.datastore.DataStore = DataStore(), run_datastores: list = list())A container class for managing experimental data with multiple runs.
This class provides a structured way to organize and manage data from optimization experiments, including both experiment-wide data and data from individual runs.
Directory structure when saved:
.. code-block:: text
base_dir/
├── experiment/ # Experiment-wide data
│ ├── problems_*.problem
│ ├── instances_*.instance
│ └── ...
└── runs/ # Individual run data
├── 0/ # First run
│ ├── problems_*.problem
│ ├── solutions_*.solution
│ └── ...
├── 1/ # Second run
└── ...Methods¶
add_run_datastore¶
add_run_datastore(run_datastore: minto.v1.datastore.DataStore, with_save = False, save_dir: str | pathlib.Path = '.') -> intAdd a new run datastore to the experiment.
Parameters:
| Name | Type | Description |
|---|---|---|
run_datastore | minto.v1.datastore.DataStore | The datastore for the new run |
Returns:
| Type | Description |
|---|---|
int | ID assigned to the new run |
add_exp_data¶
add_exp_data(name: str, obj, storage_name: str, with_save = False, save_dir: str | pathlib.Path = '.')Add data to the experiment-wide storage.
Parameters:
| Name | Type | Description |
|---|---|---|
name | str | Identifier for the data |
obj | Any | The data to store |
storage_name | str | Type of storage to use |
with_save | bool | Whether to save immediately. Defaults to False. |
save_dir | `str | Path` |
add_run_data¶
add_run_data(run_id: int, name: str, obj, storage_name: str, with_save = False, save_dir: str | pathlib.Path = '.')Add data to a specific run’s storage.
Parameters:
| Name | Type | Description |
|---|---|---|
run_id | int | ID of the run to add data to |
name | str | Identifier for the data |
obj | Any | The data to store |
storage_name | str | Type of storage to use |
with_save | bool | Whether to save immediately. Defaults to False. |
save_dir | `str | Path` |
Raises:
| Exception | Description |
|---|---|
ValueError | If run_id is not found in run_datastores |
save_dir¶
save_dir(base_dir: str | pathlib.Path)Save all experiment data to a directory structure.
Creates a directory structure containing all experiment and run data, organized according to the standard layout.
Parameters:
| Name | Type | Description |
|---|---|---|
base_dir | `str | Path` |
load_from_dir¶
classmethod
load_from_dir(base_dir: str | pathlib.Path) -> minto.v1.exp_dataspace.ExperimentDataSpaceLoad an experiment data space from a directory structure.
Parameters:
| Name | Type | Description |
|---|---|---|
base_dir | `str | Path` |
Returns:
| Type | Description |
|---|---|
minto.v1.exp_dataspace.ExperimentDataSpace | New instance containing the loaded data |
Raises:
| Exception | Description |
|---|---|
minto.v1.exceptions.FileNotFoundError | If the directory does not exist |
minto.v1.exceptions.FileCorruptionError | If a file is corrupted or has invalid format |
minto.v1.exceptions.MissingMetadataError | If required metadata is missing |
minto.v1.exceptions.InvalidMetadataError | If metadata has invalid format or values |
add_to_artifact_builder¶
add_to_artifact_builder(builder: ommx.artifact.ArtifactBuilder)Add all experiment data to an OMMX artifact builder.
Adds both experiment-wide data and run data to the artifact builder, with appropriate annotations to maintain the hierarchical structure.
Parameters:
| Name | Type | Description |
|---|---|---|
builder | ommx.artifact.ArtifactBuilder | The artifact builder to add data to |
load_from_ommx_archive¶
classmethod
load_from_ommx_archive(path: str | pathlib.Path) -> minto.v1.exp_dataspace.ExperimentDataSpaceCreate an experiment data space from an OMMX artifact.
Loads and organizes data from an OMMX artifact, reconstructing the experiment and run structure based on layer annotations.
Parameters:
| Name | Type | Description |
|---|---|---|
path | `str | Path` |
Returns:
| Type | Description |
|---|---|
minto.v1.exp_dataspace.ExperimentDataSpace | New instance containing the loaded data |
Raises:
| Exception | Description |
|---|---|
minto.v1.exceptions.FileNotFoundError | If the archive file does not exist |
minto.v1.exceptions.FileCorruptionError | If the archive file is corrupted or has invalid format |
minto.v1.exceptions.MissingMetadataError | If required metadata is missing |
minto.v1.exceptions.InvalidMetadataError | If metadata has invalid format or values |
load_from_ommx_artifact¶
classmethod
load_from_ommx_artifact(artifact: ommx.artifact.Artifact) -> minto.v1.exp_dataspace.ExperimentDataSpaceCreate an experiment data space from an OMMX artifact.
Loads and organizes data from an OMMX artifact, reconstructing the experiment and run structure based on layer annotations.
Parameters:
| Name | Type | Description |
|---|---|---|
artifact | ommx.artifact.Artifact | The OMMX artifact containing the data |
Returns:
| Type | Description |
|---|---|
minto.v1.exp_dataspace.ExperimentDataSpace | New instance containing the loaded data |
Raises:
| Exception | Description |
|---|---|
minto.v1.exceptions.FileNotFoundError | If the artifact is None |
minto.v1.exceptions.MissingMetadataError | If required metadata is missing |
minto.v1.exceptions.InvalidMetadataError | If metadata has invalid format or values |
minto.v1.exceptions.FileCorruptionError | If a layer is corrupted or has invalid format |