You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, thank you for this library! I've been investigating various hyperparameter importance routines, and I wanted to delve deeper into fANOVA; having a Rust implementation to look through is really nice.
I do have one small suggestion: the functions functions::mean and functions::mean_and_stddev could be updated to use Welford's online algorithm, computing the mean and standard deviation in a single pass. This would also remove the need for Clone:
pubfnmean(xs:implIterator<Item = f64>) -> f64{mean_and_stddev(xs).0}pubfnmean_and_stddev(xs:implIterator<Item = f64>) -> (f64,f64){let(mut mean,mut s,mut n) = (0.0,0.0,0.0);for x in xs {
n += 1.0;let delta = x - mean;
mean += delta / n;
s += delta *(x - mean);}assert!(n >= 2.0, "Need more than 2 values for standard deviation");(mean,(s / (n - 1.0)).sqrt())}
This also uses Bessel's correction for unbiased sample standard deviation (n - 1 instead of n).
Feel free to ignore my suggestion, and thanks again for this library!
Edit: I made some errors in my code suggestions (copy-pasting from another project). Fixed now!
The text was updated successfully, but these errors were encountered:
Thank your for reaching out.
Your suggestion sounds nice to me. So, let me consider that deeper this or next weekend.
BTW, if you're interested in creating a PR to reflect the suggestion, it is, of course, very welcomed.
Thanks for your response! I've put up PR #3 to address/suggest what I put here, plus some other general housekeeping (update tests so they still pass, get cargo clippy to be quiet). Thanks again for your time and your great project.
First off, thank you for this library! I've been investigating various hyperparameter importance routines, and I wanted to delve deeper into fANOVA; having a Rust implementation to look through is really nice.
I do have one small suggestion: the functions
functions::mean
andfunctions::mean_and_stddev
could be updated to use Welford's online algorithm, computing the mean and standard deviation in a single pass. This would also remove the need forClone
:This also uses Bessel's correction for unbiased sample standard deviation (
n - 1
instead ofn
).Feel free to ignore my suggestion, and thanks again for this library!
Edit: I made some errors in my code suggestions (copy-pasting from another project). Fixed now!
The text was updated successfully, but these errors were encountered: