Skip to content

Commit

Permalink
add epsilon to fit time estimation (#386)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #386

Adding an epsilon to our heuristic for fit time estimation to avoid division by 0

Reviewed By: JasonKChow

Differential Revision: D63404009

fbshipit-source-id: 3db637aeb9993728e2675be3143fcba6b20c78f1
  • Loading branch information
crasanders authored and facebook-github-bot committed Sep 25, 2024
1 parent b667938 commit be2db33
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 be2db33

Please sign in to comment.