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

Prevent NaN values when calculating mean #1230

Merged
merged 3 commits into from Dec 19, 2017

Conversation

Projects
None yet
2 participants
@philmtd
Contributor

philmtd commented Dec 14, 2017

This addresses the issue raised in #1173.

Credits go to @altery for providing this example to reproduce the issue (which I used to write the unit test): https://gist.github.com/altery/0efd06c4f8d0c83a44bd718e8170a49e

philmtd added some commits Dec 14, 2017

@arteam arteam merged commit 434caca into dropwizard:4.0-development Dec 19, 2017

2 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@arteam

This comment has been minimized.

Member

arteam commented Dec 19, 2017

Thanks for the fix! It looks good to me. I think we could also add a check to WeightedSnapshot to avoid 0/0 situations which lead to NaN values.

@arteam

This comment has been minimized.

Member

arteam commented Dec 19, 2017

I will cherry-pick the fix to the 3.2 branch.

@arteam arteam added this to the 3.2.6 milestone Dec 19, 2017

@arteam arteam added the bug label Dec 19, 2017

arteam added a commit that referenced this pull request Dec 19, 2017

Prevent NaN values when calculating mean (#1230)
* Remove samples with 0 weight from values to prevent NaN values when calculating mean

* Remove unnecessary throws.

* add whitespace after for
@philmtd

This comment has been minimized.

Contributor

philmtd commented Dec 20, 2017

Cool, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment