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
add mean/var to stats #22
Conversation
@ShigekiKarita "var" could use an option for calculating the sample variance or population variance. I had done some work on statistics functions last year. Do you want me to push a branch of mine somewhere so that you can see what I had done for comparison? I had written at least mean, hmean, gmean, var, std, and zscore before I got side-tracked. I took a little different approach as I viewed the axis option as coming through byDim, but mostly similar. |
@jmh530 I think that https://docs.scipy.org/doc/numpy/reference/generated/numpy.var.html
Yes. I'd like to see and merge your function. PR is always welcome. |
@ShigekiKarita Yes, I pushed all the stats functions I had written to a branch on my fork. You can view there. I can always re-work to something to something to get added, or you can just feel free to take what you want from it. EDIT: Mine still requires a little work, I don't think I had added UTs for all the seed versions of the functions. |
Hi @ShigekiKarita and @jmh530. Moments, including |
This is how it works in databases. It is preferred because of lazy input. |
I’m aware of this formula. It is faster but is numerically unstable and can
give the wrong results sometimes. I have no issue with there being multiple
algorithms as in your sum function.
…On Sat, Feb 17, 2018 at 11:57 AM Ilya ***@***.***> wrote:
This is how it works in databases. It is preferred because of lazy input.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AMJWykdOmYZUVM5JsgJmAfKzdfwIPxD0ks5tVwTlgaJpZM4SJM1x>
.
|
Not sure that resolved the issue or not, but you can see some discussion at
the link below. The example in it is clear what the issues are.
https://en.m.wikipedia.org/wiki/Algorithms_for_calculating_variance
…On Sat, Feb 17, 2018 at 12:27 PM Ilya ***@***.***> wrote:
maybe blas nrm2
http://www.netlib.org/lapack/explore-html/de/da4/group__double__blas__level1_ga4b25c539b862414e6f91ebb30b391d7c.html#ga4b25c539b862414e6f91ebb30b391d7c
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#22 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AMJWylx8wf9xsvII9N7aH5veBJ8lkYNWks5tVwvkgaJpZM4SJM1x>
.
|
For Summator!(double, Summation.kbn) squares = 0;
Summator!(double, Summation.naive) values = 0; For Summator!(T, Summation.kb2) squares = 0;
Summator!(T, Summation.kbn) values = 0; And common loop aSlice.each!((a) { squares += a * a; values += a; });
sizediff_t n = aSlice.elementsCount;
squares += -(values.sum ^^ 2 / n);
return squares.sum / (n - 1);
|
Seems to work for me.
|
No description provided.