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)); }
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)); }
public override DGamma FromStat(ISuff s) { throw new NotImplementedException(); }
public override DNormal FromStat(ISuff s) { return(DNormalBuilder.Instance.FromStat(s)); }
// 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);