botorch.fit¶
Utilities for model fitting.
- 
botorch.fit.fit_gpytorch_model(mll, optimizer=<function fit_gpytorch_scipy>, **kwargs)[source]¶
- Fit hyperparameters of a GPyTorch model. - On optimizer failures, a new initial condition is sampled from the hyperparameter priors and optimization is retried. The maximum number of retries can be passed in as a max_retries kwarg (default is 5). - Optimizer functions are in botorch.optim.fit. - Parameters
- mll ( - MarginalLogLikelihood) – MarginalLogLikelihood to be maximized.
- optimizer ( - Callable) – The optimizer function.
- kwargs ( - Any) – Arguments passed along to the optimizer function, including max_retries and sequential (controls the fitting of ModelListGP and BatchedMultiOutputGPyTorchModel models) or approx_mll (whether to use gpytorch’s approximate MLL computation).
 
- Return type
- MarginalLogLikelihood
- Returns
- MarginalLogLikelihood with optimized parameters. 
 - Example - >>> gp = SingleTaskGP(train_X, train_Y) >>> mll = ExactMarginalLogLikelihood(gp.likelihood, gp) >>> fit_gpytorch_model(mll) 
