ParamSpace#
- class obsidian.parameters.param_space.ParamSpace(params: list[Parameter])[source]#
Bases:
IParamSpace
Class designed to define the parameter space in which an optimization can be conducted.
- X_names#
A tuple of the names of the parameters.
- Type:
tuple[str]
- X_cont#
A list of the names of the continuous parameters.
- Type:
list[str]
- X_obs#
A list of the names of the observational parameters.
- Type:
list[str]
- X_discrete#
A dictionary mapping the names of the discrete parameters to their categories.
- Type:
dict[str, list[str]]
- X_task#
A dictionary mapping the names of the task parameters to their categories.
- Type:
dict[str, list[str]]
- X_min#
A tensor containing the minimum values of the parameters.
- Type:
torch.Tensor
- X_max#
A tensor containing the maximum values of the parameters.
- Type:
torch.Tensor
- X_range#
A tensor containing the range of the parameters.
- Type:
torch.Tensor
- X_static#
A list of the names of the static parameters.
- Type:
list[str]
- X_vary#
A list of the names of the varying parameters.
- Type:
list[str]
- n_dim#
The number of dimensions in the parameter space.
- Type:
int
- n_tdim#
The total number of dimensions in the parameter space after transformation.
- Type:
int
- t_map#
A dictionary mapping parameter indices to transformed indices.
- Type:
dict
- tinv_map#
A dictionary mapping transformed indices to parameter indices.
- Type:
dict
- X_discrete_idx#
A list of the indices of the discrete parameters.
- Type:
list[int]
- X_t_discrete_idx#
A list of the indices of the transformed discrete parameters.
- Type:
list[int]
- X_t_cat_idx#
A list of the indices of the transformed categorical parameters.
- Type:
list[int]
- X_t_task_idx#
The index of the transformed task parameter.
- Type:
int
- search_space#
The allowable search space for future optimization.
- Type:
pd.DataFrame
- Raises:
ValueError – If the X_names are not unique.
UnsupportedError – If there is more than one task parameter.
Methods
__init__
(params)Clears all constraints from the input space.
constrain_inputs
(constraint)Constrains the input space based on the specified equality, inequality, or nonlinear constraint.
decode
(X)Decode parameter from transformed space
encode
(X)Encode parameter to a format that can be used for training
load_state
(obj_dict)Loads the state of the ParamSpace object from a dictionary.
Maps the inverse of the transformed dictionary.
Maps the parameter indices to transformed indices based on the parameter types.
mean
()Calculates the mean values for each parameter in the parameter space.
Set the search space to the parameter space
Saves the state of the ParamSpace object.
unit_demap
(X)Map from 0,1 space to measured space
unit_map
(X)Map from measured to 0,1 space
Attributes
Returns the search space for the parameter space.
- constrain_inputs(constraint: Input_Constraint) None [source]#
Constrains the input space based on the specified equality, inequality, or nonlinear constraint.
- Parameters:
constraint (Input_Constraint) – The constraint to be applied to the input space.
- classmethod load_state(obj_dict: dict)[source]#
Loads the state of the ParamSpace object from a dictionary.
- Parameters:
obj_dict (dict) – A dictionary containing the state of the ParamSpace object.
- Returns:
A new ParamSpace object with the loaded state.
- Return type:
- map_inv_transform() dict [source]#
Maps the inverse of the transformed dictionary.
- Returns:
A dictionary where the keys are the original values and the values are the original keys.
- Return type:
dict
- map_transform() dict [source]#
Maps the parameter indices to transformed indices based on the parameter types.
- Returns:
A dictionary mapping parameter indices to transformed indices.
- Return type:
dict
- mean() DataFrame [source]#
Calculates the mean values for each parameter in the parameter space.
- Returns:
A DataFrame containing the mean values for each parameter.
- Return type:
pd.DataFrame
- save_state() dict [source]#
Saves the state of the ParamSpace object.
- Returns:
A dictionary containing the state of the ParamSpace object.
- Return type:
dict
- property search_space: DataFrame#
Returns the search space for the parameter space.
- Returns:
A dataframe containing the search space for the parameter space.
- Return type:
pd.DataFrame