emukit.quadrature.loop package
Module contents
Loops for Bayesian quadrature.
- class emukit.quadrature.loop.BayesianMonteCarlo(model, model_updater=None)
Bases:
OuterLoop
The loop for Bayesian Monte Carlo (BMC).
Nodes are samples from the integration measure. Implemented as described in Section 2.1 of the paper.
References
C.E. Rasmussen and Z. Ghahramani, Bayesian Monte Carlo, Advances in Neural Information Processing Systems 15 (NeurIPS) 2003
Note
The BMC point calculator does not depend on past observations. Thus, running this BQ loop should be equivalent to sampling all points with MC from the measure, evaluating them as batch and then fitting a model to them. The purpose of this loop is convenience, as it can be used with the same interface as the active and adaptive learning schemes where point acquisition depends explicitly or implicitly (through hyperparameters) on the previous evaluations.
Hint: The default
model_updater
FixedIntervalUpdater
updates and optimizes the model after each new sample. Since the sampling scheme of BMC does not depend on the model, alternatively, the dummy updaterNoopModelUpdater
may be used which does not update the model. This may save compute time. However, the model then needs to be updated manually after the loop ran: i) the collected nodes are stored inmodel.loop_state
. ii) callmodel.set_data(loop_state.X, loop_state.Y)
iii) callmodel.optimize()
.See also
- Parameters:
model (
WarpedBayesianQuadratureModel
) – A warped Bayesian quadrature model.model_updater (
Optional
[ModelUpdater
]) – Defines how and when the quadrature model is updated if new data arrives, defaults toFixedIntervalUpdater
.
- class emukit.quadrature.loop.VanillaBayesianQuadratureLoop(model, acquisition=None, model_updater=None, acquisition_optimizer=None)
Bases:
OuterLoop
The loop for standard (‘vanilla’) Bayesian Quadrature.
- Parameters:
model (
VanillaBayesianQuadrature
) – The vanilla Bayesian quadrature model.acquisition (
Optional
[Acquisition
]) – The acquisition function that is used to collect new points, defaults to integral-variance-reduction.model_updater (
Optional
[ModelUpdater
]) – Defines how and when the BQ model is updated if new data arrives. Defaults to updating hyper-parameters after every iteration.acquisition_optimizer (
Optional
[AcquisitionOptimizerBase
]) – Optimizer selecting next evaluation points by maximizing acquisition. Gradient based optimizer is used if None. Defaults to None.
- class emukit.quadrature.loop.WSABILLoop(model, model_updater=None, acquisition_optimizer=None)
Bases:
OuterLoop
The loop for WSABI-L.
References
Gunter et al. 2014 Sampling for Inference in Probabilistic Models with Fast Bayesian Quadrature, Advances in Neural Information Processing Systems (NeurIPS), 27, pp. 2789–2797.
See also
- Parameters:
model (
WSABIL
) – The WSABI-L model.model_updater (
Optional
[ModelUpdater
]) – Defines how and when the quadrature model is updated if new data arrives. Defaults to updating hyper-parameters every iteration.acquisition_optimizer (
Optional
[AcquisitionOptimizerBase
]) – Optimizer selecting next evaluation points by maximizing acquisition. Gradient based optimizer is used if None. Defaults to None.
Submodules
Point calculators for Bayesian quadrature.
- class emukit.quadrature.loop.point_calculators.BayesianMonteCarloPointCalculator(model, parameter_space)
Bases:
CandidatePointCalculator
This point calculator produces Monte Carlo points from the integration measure.
It can be used for Bayesian Monte Carlo (BMC) [1] as described in Section 2.1 of the paper.
References
[1] C.E. Rasmussen and Z. Ghahramani, Bayesian Monte Carlo, Advances in Neural Information Processing Systems 15 (NeurIPS) 2003
- Parameters:
model (
WarpedBayesianQuadratureModel
) – A warped Bayesian quadrature model.parameter_space (
ParameterSpace
) – The parameter space.
- Raises:
ValueError – If integration measure provided through the model does have sampling capabilities.
- compute_next_points(loop_state, context=None)
Computes the next point.
- Parameters:
- Return type:
ndarray
- Returns:
The next point to evaluate the function at, shape (1, input_dim).