ExpDesigner#
- class obsidian.experiment.design.ExpDesigner(X_space: ParamSpace, seed: int | None = None)[source]#
Bases:
objectExpDesigner is a base class for designing experiments in a parameter space.
- X_space#
The parameter space for the experiment.
- Type:
- seed#
The randomization seed.
- Type:
int | None
- Raises:
TypeError – If X_space is not an obsidian ParamSpace object.
- __init__(X_space: ParamSpace, seed: int | None = None)[source]#
Methods
__init__(X_space[, seed])initialize([m_initial, method, sample_custom])Initializes the experiment design.
load_state(obj_dict[, X_space, seed])Reconstruct an
ExpDesignerfrom a saved state dictionary.Save the designer state to a JSON-safe dictionary.
- initialize(m_initial: int | None = None, method: str = 'LHS', sample_custom: Tensor | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None) DataFrame[source]#
Initializes the experiment design.
- Parameters:
m_initial (int) – The number of experiments to initialize.
method (str, optional) – The method to use for initialization. Defaults to
'LHS'.sample_custom (Tensor | ArrayLike | None, optional) – Custom samples for initialization. Defaults to
None.
- Returns:
The initialized experiment design.
- Return type:
pd.DataFrame
- Raises:
KeyError – If method is not one of the supported methods.
ValueError – If sample_custom is None when method is ‘Custom’.
ValueError – If the number of columns in sample_custom does not match the size of the feature space.
- classmethod load_state(obj_dict: dict, X_space=None, seed: int | None = None) ExpDesigner[source]#
Reconstruct an
ExpDesignerfrom a saved state dictionary.- Parameters:
obj_dict (dict) – Output of
save_state().X_space – Override for the parameter space. When provided (typically by
Campaign.load_state()), the X_space payload inobj_dictis ignored. Defaults toNone.seed (int | None, optional) – Override for the seed. When provided,
obj_dict['seed']is ignored. Defaults toNone.
- Returns:
A new designer instance equivalent to the saved one.
- Return type: