@@ -116,9 +116,10 @@ def _plot(self, result_object, learning_curves, hyperparameter_names, reset_time
116116 data ['colors_iteration' ].append (c_id [0 ])
117117
118118 # Tooltips
119- tooltips = [(key , '@' + key ) for key in data .keys () if not key in ['times' , 'duration' , 'colors' ,
120- 'colors_performance' , 'colors_iteration' ]]
119+ tooltips = [(key , '@' + key ) for key in data .keys () if not key in ['times' , 'duration' , 'colors' ,
120+ 'colors_performance' , 'colors_iteration' ]]
121121 tooltips .insert (4 , ('duration (sec)' , '@duration' ))
122+ tooltips .insert (5 , ('Configuration' , ' ' ))
122123 hover = HoverTool (tooltips = tooltips )
123124
124125 # Create sources
@@ -154,14 +155,15 @@ def _plot(self, result_object, learning_curves, hyperparameter_names, reset_time
154155 p = figure (plot_height = 500 , plot_width = 600 ,
155156 y_axis_type = y_axis_type ,
156157 tools = [hover , 'save' , 'pan' , 'wheel_zoom' , 'box_zoom' , 'reset' ],
157- x_axis_label = 'Time' , y_axis_label = 'Quality ' ,
158+ x_axis_label = 'Time' , y_axis_label = 'Cost ' ,
158159 x_range = Range1d (x_min , x_max , bounds = 'auto' ),
159160 y_range = Range1d (y_min , y_max , bounds = 'auto' ),
160161 )
161162
162163 # Plot per HB_iteration, each config individually
163164 HB_iterations = sorted (set (data ['HB_iteration' ]))
164- HB_handles = []
165+ max_label_len = max ([len (l ) for l in HB_iterations ])
166+ HB_handles , HB_labels = [], []
165167 self .logger .debug ("Assuming config_info to be either \" model_based_pick=True\" or \" model_based_pick=False\" " )
166168 for it in HB_iterations :
167169 line_handles = []
@@ -197,12 +199,15 @@ def _plot(self, result_object, learning_curves, hyperparameter_names, reset_time
197199 size = 20 ,
198200 ))
199201 HB_handles .append (line_handles )
202+ HB_labels .append ('warmstart data' if l in [- 1 , '-1' ] else '{number:0{width}d}' .format (width = max_label_len ,
203+ number = int (it )))
200204
201- iteration_labels = sorted (['warmstart data' if l in [- 1 , '-1' ] else '{:02d}' .format (int (l )) for l in HB_iterations ])
202- self .logger .debug ("iteration_labels: %s" , str (iteration_labels ))
203- self .logger .debug ("HB_iterations: %s" , str (HB_iterations ))
205+ # Sort all lists according to label
206+ HB_iterations , HB_handles , HB_labels = zip (* sorted (zip (HB_iterations , HB_handles , HB_labels ), key = lambda tup : tup [2 ]))
207+ HB_iterations , HB_handles , HB_labels = list (HB_iterations ), list (HB_handles ), list (HB_labels )
208+ self .logger .debug ("HB_iterations to labels: %s" , str (list (zip (HB_iterations , HB_labels ))))
204209
205- checkbox , select_all , select_none = get_checkbox (HB_handles , iteration_labels )
210+ checkbox , select_all , select_none = get_checkbox (HB_handles , HB_labels )
206211
207212 callback_color = CustomJS (args = dict (source_multiline = source_multiline ,
208213 source_scatter = source_scatter ,
@@ -226,12 +231,17 @@ def _plot(self, result_object, learning_curves, hyperparameter_names, reset_time
226231 }}
227232 source.change.emit();
228233 """ .format (min_perf , max_perf , min_iter , max_iter ))
229- select_color = Select (title = "Select colors" , value = "performance" , options = ["performance" , "iteration" ],
230- callback = callback_color )
231234
235+ select_color = Select (title = "Select colors" ,
236+ value = "performance" ,
237+ options = ["performance" , "iteration" ],
238+ callback = callback_color )
232239
233- # Put it all together
234- layout = column (p , row (widgetbox (select_all , select_none , width = 100 ), widgetbox (checkbox , width = 500 ),
240+ # Put it all together in a layout (width of checkbox-field sizes with number of elements
241+ width_of_checkbox = 650 if len (HB_labels ) > 100 else 500 if len (HB_labels ) > 70 else 400
242+ layout = row (p , column (widgetbox (checkbox , width = width_of_checkbox ),
243+ row (widgetbox (select_all , width = 50 ),
244+ widgetbox (select_none , width = 50 )),
235245 widgetbox (select_color , width = 200 )))
236246 return layout
237247
0 commit comments