hyper_opt
Base class for all hyperparameter optimizers.
- class HyperOpt(params: Parameters, data=None, use_pkl_checkpoints=False)[source]
Bases:
ABC
Base class for hyperparameter optimizer.
- Parameters:
params (mala.common.parametes.Parameters) – Parameters used to create this hyperparameter optimizer.
data (mala.datahandling.data_handler.DataHandler) – DataHandler holding the data for the hyperparameter optimization.
use_pkl_checkpoints (bool) – If true, .pkl checkpoints will be created.
- params
MALA Parameters object.
- Type:
mala.common.parametes.Parameters
- add_hyperparameter(opttype='float', name='', low=0, high=0, choices=None)[source]
Add a hyperparameter to the current investigation.
- Parameters:
opttype (string) –
Datatype of the hyperparameter. Follows optuna’s naming conventions. In principle supported are:
float
int
categorical (list)
Float and int are not available for OA based approaches at the moment.
name (string) – Name of the hyperparameter. Please note that these names always have to be distinct; if you e.g. want to investigate multiple layer sizes use e.g. ff_neurons_layer_001, ff_neurons_layer_002, etc. as names.
low (float or int) – Lower bound for numerical parameter.
high (float or int) – Higher bound for numerical parameter.
choices – List of possible choices (for categorical parameter).
- classmethod checkpoint_exists(checkpoint_name, use_pkl_checkpoints=False)[source]
Check if a hyperparameter optimization checkpoint exists.
Returns True if it does.
- Parameters:
checkpoint_name (string) – Name of the checkpoint.
use_pkl_checkpoints (bool) – If true, .pkl checkpoints will be loaded.
- Returns:
checkpoint_exists – True if the checkpoint exists, False otherwise.
- Return type:
bool
- abstract perform_study()[source]
Perform the study, i.e. the optimization.
This is done by sampling a certain subset of network architectures.