DeepSDFStruct.design_of_experiments#
Design of Experiments (DOE) for DeepSDF Training#
This module provides tools for conducting systematic design of experiments when training DeepSDF neural network models. It integrates with MLflow for experiment tracking and supports automated hyperparameter sweeps.
Key Features#
- ExperimentSpecifications
A flexible dictionary-like class for managing experiment configurations with support for: - Loading specifications from JSON files - Recursive updates for nested parameter structures - Deep copying to prevent unintended modifications - Flattening nested configurations for logging - Saving configurations for reproducibility
- MLflow Integration
Automatic tracking of: - Training metrics (loss curves, validation scores) - Model checkpoints - Hyperparameters and configurations - Dataset information - Experiment metadata
The module simplifies the process of running large-scale hyperparameter searches and ablation studies for DeepSDF model training, with built-in versioning and reproducibility features.
Examples
Run an experiment with custom specifications:
from DeepSDFStruct.design_of_experiments import ExperimentSpecifications
# Load base configuration
specs = ExperimentSpecifications('config.json')
# Update hyperparameters
specs.update({
'learning_rate': 0.001,
'batch_size': 32,
'num_epochs': 100
})
# Run training with tracking
# train_with_specs(specs)
Create and modify experiment configurations:
specs = ExperimentSpecifications({
'model': {
'layers': [512, 512, 512],
'activation': 'relu'
},
'training': {
'lr': 0.0005
}
})
# Flatten for logging
flat_params = specs.flatten()
print(flat_params) # {'model.layers': [...], 'model.activation': 'relu', ...}
Functions
|
Create a new experiment directory and specs.json file, copying defaults and applying overrides. |
|
Creates an experiment with overrides, trains the model, and logs everything to MLflow. |
Classes
|
A dictionary-like class to hold and update experiment specifications. |
- class DeepSDFStruct.design_of_experiments.ExperimentSpecifications(specs=None)#
Bases:
dictA dictionary-like class to hold and update experiment specifications. Supports recursive updates for nested dictionaries. Can be initialized from a dictionary or loaded from a file (JSON/YAML).
- Parameters:
specs (Dict[str, Any] | str | None)
- copy()#
Return a deep copy of the specifications.
- flatten(parent_key='', sep='.')#
Flatten nested dictionary (including lists of dicts) into a single-level dict with dot-separated keys.
- Return type:
Dict[str,Any]- Parameters:
parent_key (str)
sep (str)
- save(filename)#
Save current specifications to a JSON or YAML file.
- Return type:
None- Parameters:
filename (str)
- update(updates)#
Recursively update the experiment specifications with new values.
- Return type:
None- Parameters:
updates (Dict[str, Any])
- DeepSDFStruct.design_of_experiments.create_experiment(exp_dir, specs)#
Create a new experiment directory and specs.json file, copying defaults and applying overrides.
- Parameters:
exp_dir (str) – Path to new experiment directory.
specs (dict) – Dictionary containing the experiment specifications.
- DeepSDFStruct.design_of_experiments.run_experiment(exp_name, data_dir, batch_split=1, run_name=None, specs=None, device='cpu', tracking_uri='mlruns')#
Creates an experiment with overrides, trains the model, and logs everything to MLflow.
- Parameters:
exp_name (str) – Name of the experiment folder.
data_dir (str) – Path to the dataset.
specs (dict) – Experiment specifications
device (str) – Training device (‘cpu’ or ‘cuda’).
mlflow_experiment_name (str) – Name of the MLflow experiment.
register_model (bool) – If True, register the final model in MLflow Model Registry.