-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
TensorTests.cs and Tensor.cs StdDev calculates Variance rather than Standard deviations #110381
Comments
Tagging subscribers to this area: @dotnet/area-system-numerics-tensors |
would you look at a PR for this? |
Btw, in SqlServer, for example, there are two different functions for calculating (un)biased standard deviation. |
If the mean is calculated then the N-minus-one, (unbiased), method should be the default. |
Agreed. I think it should be clarified in the documentation to avoid confusion (whichever version is chosen). |
Description
The StdDev routine lacks a square root at the end. The test also lacks the square root.
Easy to fix, rename to Variance and add a new function to calaculate the STdDev by taking the square root.
However... This is normally* -( see what we did there) used for sample sets and not usually populations So it might be best to add and option to define the sample or popukation usage,, but that is a nuance compare to delivering the wrong thing entirely. (difference being adjustment for degrees of freedom which is division by N or (N-1) - because estimating the mean "uses up" some fraction of the variation)
Reproduction Steps
Calculate the StdDev of almost anything
var t = Enumerable.Range(-32, 64).Select(x => 1.0 * x).ToArray();
var tt = new ReadOnlyTensorSpan (t.AsSpan());
var s = Tensor.StdDev(tt);
Console.WriteLine(s);
Expected behavior
Something like 18.47
Actual behavior
341.25
Regression?
No response
Known Workarounds
Take the square root,
Configuration
dotnet 9
Other information
No response
The text was updated successfully, but these errors were encountered: