8.2.2. The Bayesian Extension and utilities
Summary of the main classes for the Bayesian Optimization extension
|
PyMoDAQ extension of the DashBoard to perform the optimization of a target signal taken form the detectors as a function of one or more parameters controlled by the actuators. |
8.2.2.1. The Extension module
- class pymodaq.extensions.BayesianOptimization(dockarea, dashboard)[source]
PyMoDAQ extension of the DashBoard to perform the optimization of a target signal taken form the detectors as a function of one or more parameters controlled by the actuators.
Methods
Here you can reimplement specific attributes
thread_status(status)update_after_actuators_changed(actuators)Actions to do after the actuators have been updated
Get the selected prediction function options and pass them to the Runner
value_changed(param)to be subclassed for actions to perform when one of the param's value in self.settings is changed
config_saver
runner
set_algorithm
validate_config
- update_after_actuators_changed(actuators)[source]
Actions to do after the actuators have been updated
- update_prediction_function()[source]
Get the selected prediction function options and pass them to the Runner
Should be reimplemented in real Optimizer implementation
- value_changed(param)[source]
to be subclassed for actions to perform when one of the param’s value in self.settings is changed
For instance:
if param.name() == 'do_something': if param.value(): print('Do something') self.settings.child('main_settings', 'something_done').setValue(False)
- Parameters:
param (
Parameter) – the parameter whose value just changed
8.2.2.2. The Base Models
The models are shared by all the optimizer extensions (see pymodaq.extensions.optimizers_base).
- class pymodaq.extensions.optimizers_base.models.OptimizerModelGeneric(optimization_controller)[source]
- Attributes:
- optimization_algorithm
Methods
convert_input(measurements)Convert the measurements in the units to be fed to the Optimisation Controller
convert_output(outputs[, best_individual])Convert the output of the Optimisation Controller in units to be fed into the actuators :param outputs: output value from the controller from which the model extract a value of the same units as the actuators :type outputs:
dict[str,Union[float,ndarray]] :param best_individual: the coordinates of the best individual so far :type best_individual:Optional[dict[str,float]]Should return True if the model defined a 0D data to be used as fitness value
To be subclassed
To be subclassed
Called when updating the live plots
update_settings(param)Get a parameter instance whose value has been modified by a user on the UI To be overwritten in child class
check_modules
ini_model_base
update_detector_names
- convert_input(measurements)[source]
Convert the measurements in the units to be fed to the Optimisation Controller
- Parameters:
measurements (
DataToExport) – data object exported from the detectors from which the model extract a float value (fitness) to be fed to the algorithm- Return type:
- convert_output(outputs, best_individual=None)[source]
Convert the output of the Optimisation Controller in units to be fed into the actuators :param outputs: output value from the controller from which the model extract a value of the same units as the actuators :type outputs:
dict[str,Union[float,ndarray]] :param best_individual: the coordinates of the best individual so far :type best_individual:Optional[dict[str,float]]- Returns:
DataToActuatorOpti – attribute, either ‘rel’ for relative or ‘abs’ for absolute.
- Return type:
DataToActuators
- abstractmethod has_fitness_observable()[source]
Should return True if the model defined a 0D data to be used as fitness value
- Return type:
- class pymodaq.extensions.optimizers_base.models.OptimizerModelDefault(optimization_controller)[source]
Methods
convert_input(measurements)Convert the measurements in the units to be fed to the Optimisation Controller
convert_output(outputs[, best_individual])Convert the output of the Optimisation Controller in units to be fed into the actuators :param outputs: output value from the controller from which the model extract a value of the same units as the actuators :type outputs:
dict[str,Union[float,ndarray]] :param best_individual: the coordinates of the best individual so far :type best_individual:Optional[dict[str,float]]Should return True if the model defined a 0D data to be used as fitness value
ini_model()update_settings(param)optimize_from
- convert_input(measurements)[source]
Convert the measurements in the units to be fed to the Optimisation Controller
- Parameters:
measurements (
DataToExport) – data object exported from the detectors from which the model extract a float value (fitness) to be fed to the algorithm- Return type:
- convert_output(outputs, best_individual=None)[source]
Convert the output of the Optimisation Controller in units to be fed into the actuators :param outputs: output value from the controller from which the model extract a value of the same units as the actuators :type outputs:
dict[str,Union[float,ndarray]] :param best_individual: the coordinates of the best individual so far :type best_individual:Optional[dict[str,float]]- Returns:
DataToActuatorOpti – attribute, either ‘rel’ for relative or ‘abs’ for absolute.
- Return type:
DataToActuators