From 871f3a6ea3e5164605d729823c0e8a34d7fb18ae Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Mon, 23 Mar 2015 14:28:56 +0000 Subject: [PATCH 1/2] [verbose opt] ipython notebook new version widget changes --- GPy/core/verbose_optimization.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/GPy/core/verbose_optimization.py b/GPy/core/verbose_optimization.py index f84cfc7e..e95f643e 100644 --- a/GPy/core/verbose_optimization.py +++ b/GPy/core/verbose_optimization.py @@ -28,19 +28,20 @@ class VerboseOptimization(object): try: from IPython.display import display - from IPython.html.widgets import FloatProgressWidget, HTMLWidget, ContainerWidget - self.text = HTMLWidget() - self.progress = FloatProgressWidget() - self.model_show = HTMLWidget() + from IPython.html.widgets import IntProgress, HTML, Box, VBox, HBox, FlexBox + self.text = HTML(width='100%') + self.progress = IntProgress(description='Progress:', min=0, max=maxiters) + #self.progresstext = Text(width='100%', disabled=True, value='0/{}'.format(maxiters)) + self.model_show = HTML() self.ipython_notebook = ipython_notebook except: # Not in Ipython notebook self.ipython_notebook = False if self.ipython_notebook: - left_col = ContainerWidget(children = [self.progress, self.text]) - right_col = ContainerWidget(children = [self.model_show]) - self.hor_align = ContainerWidget(children = [left_col, right_col]) + left_col = VBox(children=[self.progress, self.text], padding=2, width='40%') + right_col = Box(children=[self.model_show], padding=2, width='60%') + self.hor_align = FlexBox(children = [left_col, right_col], width='100%', orientation='horizontal') display(self.hor_align) @@ -105,7 +106,8 @@ class VerboseOptimization(object): html_body += "{}".format(val) html_body += "" self.text.value = html_begin + html_body + html_end - self.progress.value = 100*(self.iteration+1)/self.maxiters + self.progress.value = (self.iteration+1) + #self.progresstext.value = '0/{}'.format((self.iteration+1)) self.model_show.value = self.model._repr_html_() else: n_exps = exponents(self.fnow, self.current_gradient) @@ -149,7 +151,7 @@ class VerboseOptimization(object): if not self.ipython_notebook: print '' print 'Optimization finished in {0:.5g} Seconds'.format(self.stop-self.start) - print 'Optimization status: {0:.5g}'.format(self.status) + print 'Optimization status: {0:s}'.format(self.status) print elif self.clear: self.hor_align.close() From 66c7da879a621de17cdbe84f60b38ab28d994345 Mon Sep 17 00:00:00 2001 From: mzwiessele Date: Mon, 23 Mar 2015 14:30:25 +0000 Subject: [PATCH 2/2] [verbose opt] ipython notebook new version widget changes --- GPy/core/verbose_optimization.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPy/core/verbose_optimization.py b/GPy/core/verbose_optimization.py index e95f643e..54e650c3 100644 --- a/GPy/core/verbose_optimization.py +++ b/GPy/core/verbose_optimization.py @@ -30,7 +30,7 @@ class VerboseOptimization(object): from IPython.display import display from IPython.html.widgets import IntProgress, HTML, Box, VBox, HBox, FlexBox self.text = HTML(width='100%') - self.progress = IntProgress(description='Progress:', min=0, max=maxiters) + self.progress = IntProgress(min=0, max=maxiters) #self.progresstext = Text(width='100%', disabled=True, value='0/{}'.format(maxiters)) self.model_show = HTML() self.ipython_notebook = ipython_notebook