Example #1
0
        public override DNormal FromStat(ISuff s)
        {
            double mean     = s.GetFirstMomentAsVector()[0];
            double m2       = s.GetSecondMomentAsMatrix()[0, 0];
            double variance = m2 - mean * mean;

            return(new DNormal(mean, variance));
        }
Example #2
0
        public override DBeta FromStat(ISuff s)
        {
            double mean     = s.GetFirstMomentAsVector()[0];
            double m2       = s.GetSecondMomentAsMatrix()[0, 0];
            double variance = m2 - mean * mean;
            Beta   b        = Beta.FromMeanAndVariance(mean, variance);

            return(DBeta.FromBeta(b));
        }
Example #3
0
 public override DGamma FromStat(ISuff s)
 {
     throw new NotImplementedException();
 }
Example #4
0
 public override DNormal FromStat(ISuff s)
 {
     return(DNormalBuilder.Instance.FromStat(s));
 }
Example #5
0
        // Get the sufficient statistic for the distribution.
        // For example for a 1d Gaussian, the suff stat is [x; x.^2].
        // The returned suff stat s is such that fromStat(s) gives back d.
        //public abstract ISuff GetStat(T d);

        // Construct a distribution from the sufficient statistics s.
        public abstract T FromStat(ISuff s);