Exp dataspace
ExperimentDataSpace
dataclass
¶
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:
base_dir/
├── experiment/ # Experiment-wide data
│ ├── problems_*.problem
│ ├── instances_*.instance
│ └── ...
└── runs/ # Individual run data
├── 0/ # First run
│ ├── problems_*.problem
│ ├── solutions_*.solution
│ └── ...
├── 1/ # Second run
└── ...
Attributes:
Name | Type | Description |
---|---|---|
experiment_name | str | Name identifier for the experiment |
experiment_datastore | DataStore | Storage for experiment-wide data |
run_datastores | list[DataStore] | List of storage for individual runs |
version | ClassVar[str] | Version of the data space format |
exp_dirname | ClassVar[str] | Name of the experiment directory |
runs_dirname | ClassVar[str] | Name of the runs directory |
Source code in minto/v1/exp_dataspace.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
|
__post_init__()
¶
Initialize metadata after instance creation.
Sets up basic metadata including version, experiment name, and timestamp.
Source code in minto/v1/exp_dataspace.py
add_exp_data(name, obj, storage_name, with_save=False, save_dir='.')
¶
Add data to the experiment-wide storage.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name | str | Identifier for the data | required |
obj | Any | The data to store | required |
storage_name | str | Type of storage to use | required |
with_save | bool | Whether to save immediately. Defaults to False. | False |
save_dir | str | Path | Directory for saving. Defaults to "." | '.' |
Example
exp_space.add_exp_data("config", {"param": 1}, "objects")
Source code in minto/v1/exp_dataspace.py
add_run_data(run_id, name, obj, storage_name, with_save=False, save_dir='.')
¶
Add data to a specific run's storage.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_id | int | ID of the run to add data to | required |
name | str | Identifier for the data | required |
obj | Any | The data to store | required |
storage_name | str | Type of storage to use | required |
with_save | bool | Whether to save immediately. Defaults to False. | False |
save_dir | str | Path | Directory for saving. Defaults to "." | '.' |
Raises:
Type | Description |
---|---|
ValueError | If run_id is not found in run_datastores |
Source code in minto/v1/exp_dataspace.py
add_run_datastore(run_datastore, with_save=False, save_dir='.')
¶
Add a new run datastore to the experiment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
run_datastore | DataStore | The datastore for the new run | required |
Returns:
Name | Type | Description |
---|---|---|
int | int | ID assigned to the new run |
Example
exp_space = ExperimentDataSpace("optimization_exp") run_store = DataStore() run_id = exp_space.add_run_datastore(run_store)
Source code in minto/v1/exp_dataspace.py
add_to_artifact_builder(builder)
¶
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 | Default |
---|---|---|---|
builder | ArtifactBuilder | The artifact builder to add data to | required |
Source code in minto/v1/exp_dataspace.py
load_from_dir(base_dir)
classmethod
¶
Load an experiment data space from a directory structure.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_dir | str | Path | Base directory containing the experiment data | required |
Returns:
Name | Type | Description |
---|---|---|
ExperimentDataSpace | ExperimentDataSpace | New instance containing the loaded data |
Example
exp_space = ExperimentDataSpace.load_from_dir("./experiments/exp1")
Source code in minto/v1/exp_dataspace.py
load_from_ommx_archive(path)
classmethod
¶
Create 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 | Default |
---|---|---|---|
path | str | Path | Path to the OMMX artifact file | required |
Returns:
Name | Type | Description |
---|---|---|
ExperimentDataSpace | ExperimentDataSpace | New instance containing the loaded data |
Notes
- Uses layer annotations to distinguish between experiment and run data
- Creates empty datastores for missing runs to maintain run ID sequence
- Sets experiment_name to "unknown" if not found in metadata
Source code in minto/v1/exp_dataspace.py
save_dir(base_dir)
¶
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 | Default |
---|---|---|---|
base_dir | str | Path | Base directory for saving data | required |
Source code in minto/v1/exp_dataspace.py
Space
¶
Bases: Enum
Enumeration defining the types of spaces in the experiment data structure.
Attributes:
Name | Type | Description |
---|---|---|
EXPERIMENT | Space for experiment-wide data | |
RUN | Space for individual run data |