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
Many distributions will have some summary statistics regardless of their parameters so Option<T> should not be required, e.g. it is not semantically accurate to require unwrapping the mean of a binomial. Regardless of the sample probability, a valid Binomial type will always have some mean, but student's distribution require at least one dof, cauchy has too much tail and has no mean is never valid.
proposed solution
In lieu of generics, we can use associated types for the statistics::traits::Distribution trait1. I don't believe this would bound us in terms of generic numerics in the future either, as long as the associated type could support the generic as well, i.e.
impl<T:Float>DistributionforDistributionType{typeMu = T;// or Vector<T, Dimension, ...>typeVar = T;// or TensorCube<T, Const<2>, Dimension, ...>typeSkew = T;// or TensorCube<T, Const<3>, Dimension, ...>typeKurt = T;// or TensorCube<T, Const<4>, Dimension, ...>}
collapse MeanN and VarianceN into statistics::traits::Distribution and add Covariance and Entropy traits
rely on unimplemented!() over None when more correct. Defaulting to None when we don't have a simple expression isn't correct (may also be a little more motivating for someone to implement it over panicking).
would have to implement Covariance on matrices, Cholesky decompositions, vectors, and likely floats.
types for skewness and kurtosis will be higher order tensors than nalgebra can accomodate. so the signature could have return type of never ! before being plain ol' unimplemented!() before being implemented.
I also think renaming it could be helpful, unsure what is better, but since most of them are moments, or central moments, we could make entropy it's own, as entropy is always scalar and have a Moments trait. I think much of this is motivated from reference implementations in Math.NET's interfaces since that's how this project started. ↩
Many distributions will have some summary statistics regardless of their parameters so
Option<T>should not be required, e.g. it is not semantically accurate to require unwrapping the mean of a binomial. Regardless of the sample probability, a validBinomialtype will always have some mean, but student's distribution require at least one dof, cauchy has too much tail and has no mean is never valid.proposed solution
In lieu of generics, we can use associated types for the
statistics::traits::Distributiontrait1. I don't believe this would bound us in terms of generic numerics in the future either, as long as the associated type could support the generic as well, i.e.MeanNandVarianceNintostatistics::traits::Distributionand addCovarianceandEntropytraitsCovarianceunimplemented!()overNonewhen more correct. Defaulting toNonewhen we don't have a simple expression isn't correct (may also be a little more motivating for someone to implement it over panicking).Covarianceon matrices, Cholesky decompositions, vectors, and likely floats.!before being plain ol'unimplemented!()before being implemented.Sample code of the traits I propose adding.
Footnotes
I also think renaming it could be helpful, unsure what is better, but since most of them are moments, or central moments, we could make entropy it's own, as entropy is always scalar and have a Moments trait. I think much of this is motivated from reference implementations in Math.NET's interfaces since that's how this project started. ↩