Skip to content

Commit

Permalink
Merge pull request optuna#4712 from not522/speedup-logpdf
Browse files Browse the repository at this point in the history
Speed up `logpdf` in `_truncnorm.py`
  • Loading branch information
HideakiImamura committed May 29, 2023
2 parents 58b57eb + 27fbd30 commit a031e95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion optuna/samplers/_tpe/_truncnorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ def logpdf(
x = (x - loc) / scale

x, a, b = np.atleast_1d(x, a, b)
x, a, b = np.broadcast_arrays(x, a, b)

out = _norm_logpdf(x) - _log_gauss_mass(a, b)

x, a, b = np.broadcast_arrays(x, a, b)
out[(x < a) | (b < x)] = -np.inf
out[a == b] = math.nan

Expand Down

0 comments on commit a031e95

Please sign in to comment.