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

Online algorithm for mean and std dev #3

Merged
merged 5 commits into from
Jul 1, 2022
Merged

Online algorithm for mean and std dev #3

merged 5 commits into from
Jul 1, 2022

Conversation

genos
Copy link
Contributor

@genos genos commented Jun 29, 2022

3 commits here:

  • e2d7788: use an online (one-pass) algorithm for mean and standard deviation (plus an unbiased estimate for std dev); see Online algorithm for mean and std dev #2
  • 7bb7f85: update the tests to agree with the results due to the previous commit (some floating point values are slightly different)
  • c8902ee: fix things until cargo clippy stops complaining

@genos
Copy link
Contributor Author

genos commented Jun 29, 2022

Sorry, one more commit here: when given a single data point x, I previously had mean = x and std_dev = f64::NAN; I've just switched std_dev to be zero in that case in 7be6d91.

@sile
Copy link
Owner

sile commented Jun 29, 2022

Thank you for your PR!
I'm going to review that this weekend.

@genos
Copy link
Contributor Author

genos commented Jun 29, 2022

Looks like I neglected to run cargo fmt on the repository, my apologies!

Copy link
Owner

@sile sile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT👍
Thanks!

@sile sile merged commit fefedd1 into sile:master Jul 1, 2022
@genos genos deleted the welford-mean-sd branch July 1, 2022 11:12
@genos
Copy link
Contributor Author

genos commented Jul 1, 2022

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants