@@ -440,7 +440,9 @@ def get_hyperparameter_ticks_from_values(
440440 return tickvals , ticktext
441441
442442
443- def get_hovertext_from_config (run : AbstractRun , config_id : int ) -> str :
443+ def get_hovertext_from_config (
444+ run : AbstractRun , config_id : int , budget : Optional [Union [int , float ]] = None
445+ ) -> str :
444446 """
445447 Generate hover text with metrics for a configuration.
446448
@@ -453,6 +455,9 @@ def get_hovertext_from_config(run: AbstractRun, config_id: int) -> str:
453455 The run instance
454456 config_id : int
455457 The id of the configuration
458+ budget : Optional[Union[int, float]]
459+ Budget to get the hovertext for. If no budget is given, the highest budget is chosen.
460+ By default None.
456461
457462 Returns
458463 -------
@@ -472,12 +477,21 @@ def get_hovertext_from_config(run: AbstractRun, config_id: int) -> str:
472477
473478 # It's also nice to see the metrics
474479 objectives = run .get_objectives ()
475- budget = run .get_highest_budget (config_id )
480+ if budget is None or budget == - 1 :
481+ highest_budget = run .get_highest_budget (config_id )
482+ assert highest_budget is not None
483+ string += f"<b>Objectives</b> (on highest found budget { round (highest_budget , 2 )} )<br>"
484+ else :
485+ string += f"<b>Objectives</b> (on budget { round (budget , 2 )} )<br>"
476486
477- avg_costs , std_costs = run .get_avg_costs (config_id , budget = budget )
487+ try :
488+ avg_c , std_c = run .get_avg_costs (config_id , budget = budget )
489+ avg_costs : List [Optional [float ]] = list (avg_c )
490+ std_costs : List [Optional [float ]] = list (std_c )
491+ except ValueError :
492+ avg_costs = [None for _ in range (len (objectives ))]
493+ std_costs = [None for _ in range (len (objectives ))]
478494
479- assert budget is not None
480- string += f"<b>Objectives</b> (on highest found budget { round (budget , 2 )} )<br>"
481495 for objective , cost , std_cost in zip (objectives , avg_costs , std_costs ):
482496 if std_cost == 0.0 :
483497 string += f"{ objective .name } : { cost } <br>"
0 commit comments