예제 #1
0
 /// <summary>
 /// Sets this non-conjugate Gaussian distribution to the power of another.
 /// </summary>
 /// <param name="value">The </param>
 /// <param name="exponent"></param>
 public void SetToPower(NonconjugateGaussian value, double exponent)
 {
     MeanTimesPrecision = value.MeanTimesPrecision * exponent;
     Precision          = value.Precision * exponent;
     Shape = (value.Shape - 1) * exponent + 1;
     Rate  = value.Rate * exponent;
 }
예제 #2
0
        /// <summary>
        /// Create a uniform non-conjugate Gaussian distribution
        /// </summary>
        /// <returns></returns>
        public static NonconjugateGaussian Uniform()
        {
            var result = new NonconjugateGaussian();

            result.SetToUniform();
            return(result);
        }
예제 #3
0
 /// <summary>
 /// Sets this non-conjugate Gaussian distribution to the ratio of two others.
 /// </summary>
 /// <param name="numerator">Numerator</param>
 /// <param name="denominator">Denominator</param>
 /// <param name="forceProper">Ignored</param>
 public void SetToRatio(NonconjugateGaussian numerator, NonconjugateGaussian denominator, bool forceProper = false)
 {
     MeanTimesPrecision = numerator.MeanTimesPrecision - denominator.MeanTimesPrecision;
     Precision          = numerator.Precision - denominator.Precision;
     Shape = (numerator.Shape - 1) - (denominator.Shape - 1) + 1;
     Rate  = numerator.Rate - denominator.Rate;
 }
예제 #4
0
        /// <summary>
        /// Product operator
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        public static NonconjugateGaussian operator *(NonconjugateGaussian a, NonconjugateGaussian b)
        {
            var result = new NonconjugateGaussian();

            result.SetToProduct(a, b);
            return(result);
        }
예제 #5
0
 /// <summary>
 /// Sets this non-conjugate Gaussian distribution to the product of two others.
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 public void SetToProduct(NonconjugateGaussian a, NonconjugateGaussian b)
 {
     MeanTimesPrecision = a.MeanTimesPrecision + b.MeanTimesPrecision;
     Precision          = a.Precision + b.Precision;
     Shape = (a.Shape - 1) + (b.Shape - 1) + 1;
     Rate  = a.Rate + b.Rate;
 }
예제 #6
0
 /// <summary>
 /// Sets this non-conjugate Gaussian to another non-conjugate Gaussian
 /// </summary>
 /// <param name="value"></param>
 public void SetTo(NonconjugateGaussian value)
 {
     MeanTimesPrecision = value.MeanTimesPrecision;
     Precision          = value.Precision;
     Shape = value.Shape;
     Rate  = value.Rate;
 }
예제 #7
0
        /// <summary>
        /// The maximum difference between the parameters of this distribution and that
        /// </summary>
        /// <param name="thatd"></param>
        /// <returns></returns>
        public double MaxDiff(object thatd)
        {
            if (!(thatd is NonconjugateGaussian))
            {
                return(Double.PositiveInfinity);
            }

            NonconjugateGaussian that = (NonconjugateGaussian)thatd;

            double diff1 = MMath.AbsDiff(this.MeanTimesPrecision, that.MeanTimesPrecision);
            double diff2 = MMath.AbsDiff(this.Precision, that.Precision);
            double diff3 = MMath.AbsDiff(this.Shape, that.Shape);
            double diff4 = MMath.AbsDiff(this.Rate, that.Rate);

            return(Math.Max(Math.Max(diff1, diff2), Math.Max(diff3, diff4)));
        }
예제 #8
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="that"></param>
 public NonconjugateGaussian(NonconjugateGaussian that)
     : this()
 {
     SetTo(that);
 }
예제 #9
0
 public double GetLogAverageOfPower(NonconjugateGaussian that, double power)
 {
     throw new NotImplementedException();
 }
예제 #10
0
 public double GetAverageLog(NonconjugateGaussian that)
 {
     throw new NotImplementedException();
 }
예제 #11
0
#pragma warning disable 1591

        #region SettableToWeightedSum<NonconjugateGaussian> Members

        public void SetToSum(double weight1, NonconjugateGaussian value1, double weight2, NonconjugateGaussian value2)
        {
            throw new NotImplementedException();
        }