Main Modules¶
Assistant:¶
-
class
labwatch.assistant.
LabAssistant
(experiment, database_name=None, url=’localhost’, optimizer=None, prefix=’runs’, always_inject_observer=False)¶ The main class for Labwatch. It runs an experiment with a configuration suggested by and hyperparameter optimizer.
The hyperparameter optimizer uses the information about the experiment that are stored in the database to suggest a new configuration.
-
search_space
(function)¶ Decorator for creating a searchspace definition from a function.
-
Hyperparameters:¶
-
class
labwatch.hyperparameters.
Gaussian
(mu, sigma, log_scale=False, uid=None)¶ A Gaussian just has a different distribution
-
labwatch.hyperparameters.
decode_param_or_op
(storage)¶ Decode method for converting BSON like dicts to parameter values.
-
class
labwatch.hyperparameters.
Parameter
(uid=None, fixed=None)¶
-
class
labwatch.hyperparameters.
Constant
(value, uid=None)¶
-
class
labwatch.hyperparameters.
Categorical
(choices_in, uid=None)¶
-
class
labwatch.hyperparameters.
UniformNumber
(lower, upper, type, default=None, log_scale=False, uid=None)¶
-
class
labwatch.hyperparameters.
UniformFloat
(lower, upper, default=None, log_scale=False, uid=None)¶
-
class
labwatch.hyperparameters.
UniformInt
(lower, upper, default=None, log_scale=False, uid=None)¶
-
class
labwatch.hyperparameters.
Gaussian
(mu, sigma, log_scale=False, uid=None) A Gaussian just has a different distribution
-
class
labwatch.hyperparameters.
ConditionResult
(result, condition)¶
-
class
labwatch.hyperparameters.
Condition
(param, choices)¶
Converters:¶
-
labwatch.converters.convert_to_configspace.
configspace_config_to_sacred
(config)¶ Convert a Configuration into a dict mapping parameter names to values.
config: ConfigSpace.Configuration
- dict:
- Dictionary mapping parameter names to values.
-
labwatch.converters.convert_to_configspace.
convert_simple_param
(name, param)¶ Convert a simple labwatch parameter to a ConfigSpace parameter.
- name: str
- The name of the parameter.
- param: dict
- Dictionary describing the parameter.
- ConfigSpace.hyperparameters.Hyperparameter:
- The converted hyperparameter.
-
labwatch.converters.convert_to_configspace.
sacred_config_to_configspace
(cspace, config)¶ Fill a ConfigurationSpace with the given values and return the resulting Configuration.
- cspace: ConfigSpace.ConfigurationSpace
- The configuration space to be populated.
- config: dict
- The configuration values as a dictionary mapping names to values.
- ConfigSpace.Configuration:
- The resulting Configuration.
-
labwatch.converters.convert_to_configspace.
sacred_space_to_configspace
(space)¶ Convert a Labwatch searchspace to a ConfigSpace.
- space: labwatch.searchspace.SearchSpace
- A labwatch searchspace to be converted.
- ConfigSpace.ConfigurationSpace:
- A ConfigurationSpace equivalent to the given SeachSpace.
Optimizers:¶
-
class
labwatch.optimizers.base.
Optimizer
(config_space)¶ Defines the interface for all optimizers.
-
needs_updates
()¶ - bool:
- True if this optimizer needs updates, False otherwise.
-
suggest_configuration
()¶ Suggests a configuration of hyperparameters to be run.
- dict:
Dictionary mapping parameter names to suggested values.
The default is to return nothing this is done such that the user / the watcher can then check the queue or try something else. If you want get_random_config as default create an instance of RandomSearch instead.
-
update
(configs, costs, runs)¶ Update the internal state of the optimizer with a list of new results.
- configs: list[dict]
- List of configurations mapping parameter names to values.
- costs: list[float]
- List of costs associated to each config.
- runs: list[dict]
- List of dictionaries containing additional run information.
-
-
class
labwatch.optimizers.bayesian_optimization.
BayesianOptimization
(config_space, burnin=100, chain_length=200, n_hypers=20)¶
-
class
labwatch.optimizers.bohamiann.
Bohamiann
(config_space, burnin=3000, n_iters=10000)¶
-
class
labwatch.optimizers.dngo.
DNGOWrapper
(config_space, burnin=1000, chain_length=200, n_hypers=20)¶
-
class
labwatch.optimizers.random_search.
RandomSearch
(config_space)¶