Beispiel #1
0
 /// <summary>
 /// Get the integral of this distribution times another distribution raised to a power.
 /// </summary>
 /// <param name="that"></param>
 /// <param name="power"></param>
 /// <returns></returns>
 public double GetLogAverageOfPower(SparseGP that, double power)
 {
     throw new NotImplementedException();
     if (IsPointMass)
     {
         return(power * that.GetLogProb(Point));
     }
     else if (that.IsPointMass)
     {
         if (power < 0)
         {
             throw new DivideByZeroException("The exponent is negative and the distribution is a point mass");
         }
         return(this.GetLogProb(that.Point));
     }
     else
     {
     }
 }
Beispiel #2
0
#pragma warning disable 162
#endif

        /// <summary>
        /// Gets the log of the integral of the product of this SparseGP and that SparseGP
        /// </summary>
        /// <param name="that"></param>
        /// <returns></returns>
        public double GetLogAverageOf(SparseGP that)
        {
            if (this.FixedParameters != that.FixedParameters)
            {
                throw new ArgumentException("SparseGPs do not have the same FixedParameters.  this.FixedParameters = " + this.FixedParameters + ", that.FixedParameters = " +
                                            that.FixedParameters);
            }
            if (this.IncludePrior && that.IncludePrior)
            {
                throw new ArgumentException("Both SparseGPs include the prior");
            }
            if (that.IsPointMass)
            {
                return(GetLogProb(that.Point));
            }
            if (this.IsPointMass)
            {
                return(that.GetLogProb(this.Point));
            }
            if (this.IncludePrior && !that.IncludePrior)
            {
                // gBB is the distribution of the function on the basis
                VectorGaussian gBB;
                if (true)
                {
                    gBB = new VectorGaussian(InducingDist.Dimension);
                    gBB.Precision.SetToSum(FixedParameters.InvKernelOf_B_B, InducingDist.Precision);
                    gBB.MeanTimesPrecision.SetTo(InducingDist.MeanTimesPrecision); // since prior has zero mean
                }
                else
                {
                    // equivalent but slower
                    gBB = VectorGaussian.FromMeanAndVariance(Mean_B, Var_B_B);
                }
                return(gBB.GetLogAverageOf(that.InducingDist));
            }
            if (!this.IncludePrior && that.IncludePrior)
            {
                return(that.GetLogAverageOf(this));
            }
            throw new NotImplementedException();
        }