Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve accuracy for np.log(1 + ... ) #9

Closed
hai-dang-dau opened this issue Mar 22, 2020 · 0 comments
Closed

Improve accuracy for np.log(1 + ... ) #9

hai-dang-dau opened this issue Mar 22, 2020 · 0 comments

Comments

@hai-dang-dau
Copy link
Contributor

hai-dang-dau commented Mar 22, 2020

In the file "./particles/resampling.py", line 272: the use of np.log(1 + ...) should be replaced by np.log1p(...). The documentation of numpy says that np.log1p(x) is more accurate than np.log(1+x). Here is my experiment:

np.log(1 + np.exp(-3))
Out[66]: 0.04858735157374196
np.log1p(np.exp(-3))
Out[67]: 0.04858735157374206
@hai-dang-dau hai-dang-dau changed the title Improve accuracy for np.log(1 + ... else) Improve accuracy for np.log(1 + ... ) Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant