mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-27 14:25:16 +02:00
[progress] show progress of optimization using optimize(itpython_notebook=True)
This commit is contained in:
parent
1c6cef44b6
commit
17f42768da
1 changed files with 3 additions and 3 deletions
|
|
@ -13,7 +13,7 @@ def exponents(fnow, current_grad):
|
|||
class VerboseOptimization(object):
|
||||
def __init__(self, model, opt, maxiters, verbose=True, current_iteration=0, ipython_notebook=False):
|
||||
self.verbose = verbose
|
||||
if self.verbose:
|
||||
if self.verbose or ipython_notebook:
|
||||
self.model = model
|
||||
self.iteration = current_iteration
|
||||
self.ipython_notebook = ipython_notebook
|
||||
|
|
@ -129,7 +129,7 @@ class VerboseOptimization(object):
|
|||
self.current_gradient = np.nan
|
||||
|
||||
def __exit__(self, type, value, traceback):
|
||||
if self.verbose:
|
||||
if self.verbose or self.ipython_notebook:
|
||||
self.model.remove_observer(self)
|
||||
self.stop = time.time()
|
||||
|
||||
|
|
@ -138,4 +138,4 @@ class VerboseOptimization(object):
|
|||
if not self.ipython_notebook:
|
||||
print
|
||||
print 'Optimization finished in {0:.5g} Seconds'.format(self.stop-self.start)
|
||||
print
|
||||
print
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue