[docs]defget_optimal_hps(self)->HPSetting:""" Finds the optimal hyperparameter setting, where the optimal is the one with max/min value of the search metric. The search criterion (object attribute) defines if it should be max (its value is max function) or min (its value is min function). max corresponds to metrics such as accuracy, AUC, while min corresponds to metrics such as log loss. Returns: HPSetting object which had the optimal performance based on the metric value in the search space """iflen(list(self.search_space_metric.keys()))==1:optimal_key=list(self.search_space_metric.keys())[0]else:optimal_key=self.search_criterion({key:valueforkey,valueinself.search_space_metric.items()ifisinstance(value,float)},key=lambdak:self.search_space_metric[k])returnself.hp_settings[optimal_key]