mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-10 20:42:39 +02:00
[optimize] optional parameters taken over to GPy
This commit is contained in:
parent
e5cdc06520
commit
61286a10ee
1 changed files with 6 additions and 4 deletions
|
|
@ -532,21 +532,23 @@ class GP(Model):
|
||||||
def get_most_significant_input_dimensions(self, which_indices=None):
|
def get_most_significant_input_dimensions(self, which_indices=None):
|
||||||
return self.kern.get_most_significant_input_dimensions(which_indices)
|
return self.kern.get_most_significant_input_dimensions(which_indices)
|
||||||
|
|
||||||
def optimize(self, optimizer=None, start=None, **kwargs):
|
def optimize(self, optimizer=None, start=None, messages=False, max_iters=1000, ipython_notebook=True, clear_after_finish=False, **kwargs):
|
||||||
"""
|
"""
|
||||||
Optimize the model using self.log_likelihood and self.log_likelihood_gradient, as well as self.priors.
|
Optimize the model using self.log_likelihood and self.log_likelihood_gradient, as well as self.priors.
|
||||||
kwargs are passed to the optimizer. They can be:
|
kwargs are passed to the optimizer. They can be:
|
||||||
|
|
||||||
:param max_f_eval: maximum number of function evaluations
|
:param max_iters: maximum number of function evaluations
|
||||||
:type max_f_eval: int
|
:type max_iters: int
|
||||||
:messages: whether to display during optimisation
|
:messages: whether to display during optimisation
|
||||||
:type messages: bool
|
:type messages: bool
|
||||||
:param optimizer: which optimizer to use (defaults to self.preferred optimizer), a range of optimisers can be found in :module:`~GPy.inference.optimization`, they include 'scg', 'lbfgs', 'tnc'.
|
:param optimizer: which optimizer to use (defaults to self.preferred optimizer), a range of optimisers can be found in :module:`~GPy.inference.optimization`, they include 'scg', 'lbfgs', 'tnc'.
|
||||||
:type optimizer: string
|
:type optimizer: string
|
||||||
|
:param bool ipython_notebook: whether to use ipython notebook widgets or not.
|
||||||
|
:param bool clear_after_finish: if in ipython notebook, we can clear the widgets after optimization.
|
||||||
"""
|
"""
|
||||||
self.inference_method.on_optimization_start()
|
self.inference_method.on_optimization_start()
|
||||||
try:
|
try:
|
||||||
super(GP, self).optimize(optimizer, start, **kwargs)
|
super(GP, self).optimize(optimizer, start, messages, max_iters, ipython_notebook, clear_after_finish, **kwargs)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("KeyboardInterrupt caught, calling on_optimization_end() to round things up")
|
print("KeyboardInterrupt caught, calling on_optimization_end() to round things up")
|
||||||
self.inference_method.on_optimization_end()
|
self.inference_method.on_optimization_end()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue