@@ -45,6 +45,75 @@ def get_stars(input_list) -> list:
4545 return output_list
4646
4747
48+ def show_exp_table (fun_control : dict , tablefmt = "github" ) -> str :
49+ """Generates a table with the design variables and their bounds.
50+ Can be used for the experiment design, which was not run yet.
51+ Args:
52+ fun_control (dict):
53+ A dictionary with function design variables.
54+ Returns:
55+ (str):
56+ a table with the design variables, their default values, and their bounds.
57+ Use the `print` function to display the table.
58+ """
59+ default_values = get_default_values (fun_control )
60+ defaults = list (default_values .values ())
61+ tab = tabulate (
62+ {
63+ "name" : get_var_name (fun_control ),
64+ "type" : get_var_type (fun_control ),
65+ "default" : defaults ,
66+ "lower" : get_bound_values (fun_control , "lower" , as_list = True ),
67+ "upper" : get_bound_values (fun_control , "upper" , as_list = True ),
68+ "transform" : get_transform (fun_control ),
69+ },
70+ headers = "keys" ,
71+ tablefmt = tablefmt ,
72+ )
73+ return tab
74+
75+
76+ def show_res_table (spot : object = None , tablefmt = "github" ) -> str :
77+ """
78+ Generates a table with the design variables and their bounds,
79+ after the run was completed.
80+
81+ Args:
82+ spot (object):
83+ A spot object. Defaults to None.
84+ Returns:
85+ (str):
86+ a table with the design variables, their default values, their bounds,
87+ the value and the importance of each hyperparameter.
88+ Use the `print` function to display the table.
89+ """
90+ fun_control = spot .fun_control
91+ default_values = get_default_values (fun_control )
92+ defaults = list (default_values .values ())
93+ res = spot .print_results (print_screen = False , dict = fun_control )
94+ tuned = [item [1 ] for item in res ]
95+ importance = spot .get_importance ()
96+ stars = get_stars (importance )
97+ tab = tabulate (
98+ {
99+ "name" : get_var_name (fun_control ),
100+ "type" : get_var_type (fun_control ),
101+ "default" : defaults ,
102+ "lower" : get_bound_values (fun_control , "lower" , as_list = True ),
103+ "upper" : get_bound_values (fun_control , "upper" , as_list = True ),
104+ "tuned" : tuned ,
105+ "transform" : get_transform (fun_control ),
106+ "importance" : importance ,
107+ "stars" : stars ,
108+ },
109+ headers = "keys" ,
110+ numalign = "right" ,
111+ floatfmt = ("" , "" , "" , "" , "" , "" , "" , ".2f" ),
112+ tablefmt = tablefmt ,
113+ )
114+ return tab
115+
116+
48117def gen_design_table (fun_control : dict , spot : object = None , tablefmt = "github" ) -> str :
49118 """Generates a table with the design variables and their bounds.
50119 Args:
0 commit comments