@@ -1921,15 +1921,17 @@ def cv_results_(self):
1921
1921
metric_dict [metric .name ] = []
1922
1922
metric_mask [metric .name ] = []
1923
1923
1924
+ model_ids = []
1924
1925
mean_fit_time = []
1925
1926
params = []
1926
1927
status = []
1927
1928
budgets = []
1928
1929
1929
- for run_key in self .runhistory_ .data :
1930
- run_value = self .runhistory_ .data [run_key ]
1930
+ for run_key , run_value in self .runhistory_ .data .items ():
1931
1931
config_id = run_key .config_id
1932
1932
config = self .runhistory_ .ids_config [config_id ]
1933
+ if run_value .additional_info and "num_run" in run_value .additional_info :
1934
+ model_ids .append (run_value .additional_info ["num_run" ])
1933
1935
1934
1936
s = run_value .status
1935
1937
if s == StatusType .SUCCESS :
@@ -1990,6 +1992,8 @@ def cv_results_(self):
1990
1992
metric_dict [metric .name ].append (metric_value )
1991
1993
metric_mask [metric .name ].append (mask_value )
1992
1994
1995
+ results ["model_ids" ] = model_ids
1996
+
1993
1997
if len (self ._metrics ) == 1 :
1994
1998
results ["mean_test_score" ] = np .array (metric_dict [self ._metrics [0 ].name ])
1995
1999
rank_order = - 1 * self ._metrics [0 ]._sign * results ["mean_test_score" ]
@@ -2165,14 +2169,11 @@ def show_models(self) -> dict[int, Any]:
2165
2169
warnings .warn ("No ensemble found. Returning empty dictionary." )
2166
2170
return ensemble_dict
2167
2171
2168
- def has_key (rv , key ):
2169
- return rv .additional_info and key in rv .additional_info
2170
-
2171
2172
table_dict = {}
2172
- for run_key , run_val in self .runhistory_ .data .items ():
2173
- if has_key ( run_val , "num_run" ) :
2174
- model_id = run_val .additional_info ["num_run" ]
2175
- table_dict [model_id ] = {"model_id" : model_id , "cost" : run_val .cost }
2173
+ for run_key , run_value in self .runhistory_ .data .items ():
2174
+ if run_value . additional_info and "num_run" in run_value . additional_info :
2175
+ model_id = run_value .additional_info ["num_run" ]
2176
+ table_dict [model_id ] = {"model_id" : model_id , "cost" : run_value .cost }
2176
2177
2177
2178
# Checking if the dictionary is empty
2178
2179
if not table_dict :
0 commit comments