Skip to content

Commit

Permalink
add epsilon to fit time estimation
Browse files Browse the repository at this point in the history
Summary: Adding an epsilon to our heuristic for fit time estimation to avoid division by 0

Differential Revision: D63404009
  • Loading branch information
crasanders authored and facebook-github-bot committed Sep 25, 2024
1 parent b667938 commit 5de1751
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aepsych/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ def _fit_mll(
# figure out how long evaluating a single samp
starttime = time.time()
_ = mll(self(train_x), train_y)
single_eval_time = time.time() - starttime
single_eval_time = (
time.time() - starttime + 1e-6
) # add an epsilon to avoid divide by zero
n_eval = int(max_fit_time / single_eval_time)
optimizer_kwargs["options"] = {"maxfun": n_eval}
logger.info(f"fit maxfun is {n_eval}")
Expand Down

0 comments on commit 5de1751

Please sign in to comment.