skripts.VAE package
Submodules
skripts.VAE.VAE_interpret module
skripts.VAE.VAE_smac module
Hyperparameter tuning for a variational autoencoder for flow-injection analysis with SMAC.
- class skripts.VAE.VAE_smac.FIA_VAE_tune(data, test_size: float, configuration_space: ConfigurationSpace, model_builder, log_dir: str, batch_size: int = 16, verbosity: int = 0, device: str = 'cpu', name: str = 'smac_vae')[source]
Bases:
object
Class for running the SMAC3 tuning.
- train(config: Configuration, seed: int = 0, budget: int = 25) float [source]
Train the model for the number of defined steps.
- Parameters:
config (Configuration) – Configuration to be trained upon.
seed (int, optional) – Initializing seed, defaults to 0
budget (int, optional) – Number of epochs to be used in training, defaults to 25
- Returns:
Average loss of the model.
- Return type:
float
- skripts.VAE.VAE_smac.ask_tell_optimization(facade, smac_model, n: int = 10, verbosity: int = 0)[source]
Run the training run for n steps in a more verbose mode.
- Parameters:
facade (smac.AbstractFacade) – Facade used by SMAC.
smac_model (Keras model) – SMAC model that is used
n (int, optional) – number of verbose runs, defaults to 10
verbosity (int, optional) – verbosity of output, defaults to 0
- skripts.VAE.VAE_smac.main(args)[source]
Hyperparameter optimization with SMAC3
- Parameters:
args (dictionary-like) – Arguments from shell. See VAE_smac.py –help for more information.
- skripts.VAE.VAE_smac.run_optimization(facade, smac_model, verbose_steps: int = 10, verbosity: int = 0)[source]
Perform optimization run with SMAC facade.
- Parameters:
facade (smac.AbstractFacade) – SMAC facade
smac_model (Keras model) – Model to supply for training
verbose_steps (int, optional) – number of steps to be returned in a more verbose fashion, defaults to 10
verbosity (int, optional) – Level of verbosity, defaults to 0
- Returns:
Best hyperparameter combinations
- Return type:
Union[list, dict, ConfigSpace.Configuration]
- skripts.VAE.VAE_smac.save_runtime(run_dir, verbosity: int = 0)[source]
Saves the runtime Dataframe.
- Parameters:
run_dir (str) – Directory for saving the run.
verbosity (int, optional) – Level of verbosity, defaults to 0
- Returns:
Runtimes
- Return type:
pandas.DataFrame
- skripts.VAE.VAE_smac.time_step(message: str, verbosity: int = 0, min_verbosity: int = 1)[source]
Saves the time difference between last and current step.
- Parameters:
message (str) – Message, that will be printed and saved, along with runtime.
verbosity (int, optional) – Current verbosity., defaults to 0
min_verbosity (int, optional) – If verbosity >= min_verbosity, print message., defaults to 1
- skripts.VAE.VAE_smac.validate_incumbent(incumbent, fascade, run_dir: str, verbosity: int = 0)[source]
Saves the history of one run.
- Parameters:
incumbent (Union[list, dict, ConfigSpace.Configuration]) – The calculated incumbent (best hyperparameters)
fascade (smac.AbstractFacade) – The fascade used for computation
run_dir (str) – Directory for saving the run.
verbosity (int, optional) – Level of verbosity, defaults to 0
- Returns:
Best Hyperparameters
- Return type:
ConfigSpace.Configuration