Skip to content

Commit fcc2efd

Browse files
Update simple_cerebros_random_search.py
Refactor best metric error handling to allow +/- inf metrics (these actually will work in current versions of pd.Series.min() / ....max() ), but still exclude other arbitrary types (str, Exception)...
1 parent c587c68 commit fcc2efd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cerebros/simplecerebrosrandomsearch/simple_cerebros_random_search.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,9 @@ def has_valid_metric(num):
573573
except Exception as exc:
574574
print(exc)
575575
return False
576-
rows_having_a_valid_metric = oracles[self.metric_to_rank_by].apply(lambda x: has_valid_metric(x))
576+
# ~ pd.to_numeric(x['a'], errors="coerce").astype(float).isna()
577+
# rows_having_a_valid_metric = oracles[self.metric_to_rank_by].apply(lambda x: has_valid_metric(x))
578+
rows_having_a_valid_metric = ~ pd.to_numeric(oracles[self.metric_to_rank_by], errors="coerce").isna()
577579
oracles_having_valid_metrics = oracles[rows_having_a_valid_metric]
578580

579581
if self.direction == "maximize" or self.direction == "max":

0 commit comments

Comments
 (0)