Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into mb/add_ci_to_timedelta
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBernstorff committed May 11, 2023
2 parents ce8c63f + 2c01d58 commit 232dc93
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/psycop/model_evaluation/binary/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def calc_performance(
df: pd.DataFrame,
metric: Callable,
confidence_interval: Optional[float] = None,
n_bootstraps: int = 1000,
n_bootstraps: int = 100,
**kwargs: Any,
) -> pd.Series:
"""Calculates performance metrics of a df with 'y' and 'input_to_fn' columns.
Expand Down Expand Up @@ -59,7 +59,11 @@ def metric_wrapper(
) -> float:
# bootstrap function requires the metric function to
# be able to take additional arguments (notably the length of the array)
return metric(true, pred)
try:
return metric(true, pred)
except ValueError as e:
print(repr(e))
return np.nan

boot = bootstrap(
(df["y"], df["y_hat"]),
Expand Down

0 comments on commit 232dc93

Please sign in to comment.