Skip to content

Commit

Permalink
pop better report on complete maxlik in jupyter
Browse files Browse the repository at this point in the history
  • Loading branch information
jpn-- committed Jan 27, 2017
1 parent 6b26acf commit 6596fc3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion py/model_reporter/art.py
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ def art_simple_parameters(self, foot=None):
a.footnotes.append(str(foot))
return a

def _art_simple_status(self, *arg_ignored, **kwarg_ignored):
def _art_running_status(self, *arg_ignored, **kwarg_ignored):
from ..jupyter import jupyter_active
if jupyter_active:
try:
Expand All @@ -1424,3 +1424,12 @@ def _art_simple_status(self, *arg_ignored, **kwarg_ignored):
"At iteration {}".format(iterat),
"Convergence Tolerance = {}".format(self.bhhh_tolerance()),
]))


def _display_finalized_status(self, result=None, *arg_ignored, **kwarg_ignored):
from ..jupyter import jupyter_active
if jupyter_active:
from IPython import display
display.clear_output(wait=True)
display.display_html(self.xhtml('!'))

4 changes: 3 additions & 1 deletion py/util/optimize/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def optimizers(model, *arg, ctol=1e-7):
ot = OptimizeTechniques(ctol=ctol, ctol_fun=model.bhhh_tolerance, logger=model.logger(),
fun = model.negative_loglike, bhhh = model.bhhh,
jac = model.negative_d_loglike,
callback=model._art_simple_status,
callback=model._art_running_status,
)
for a in arg:
if isinstance(a,dict):
Expand Down Expand Up @@ -461,6 +461,8 @@ def maximize_loglike(model, *arg, ctol=1e-6, options={}, metaoptions=None, two_s
if stash:
model.stash_parameters(ticket=stash)

model._display_finalized_status(r)

return r


Expand Down

0 comments on commit 6596fc3

Please sign in to comment.