forked from tsai/mathnet-numerics
Browse Source
Categorical.Mean was being calculated as _pmfNormalized.Mean(), which is actually the mean probability across all possible values, rather than the mean value of the distribution. I've replaced it with a loop which performs the following standard calculation for mean value: mean = Sum(x * f(x), x=0..N) where f(x) is the probability mass function, and N is the maximum value. An alternate method of calculation is: Mean = Sum( 1 - F(x), x=0..N) or similar[1]. That might be preferable if it results in less computational error, but it's a bit obscure, so for clarity I decided to go with the standard calculation for mean value. [1]: https://en.wikipedia.org/w/index.php?title=Expected_value&oldid=585750484#Discrete_distribution_taking_only_non-negative_integer_valuesprovider
1 changed files with 12 additions and 1 deletions
Loading…
Reference in new issue