Example #1
0
        /// <summary>
        /// The maximum difference in parameter values between this distribution and that distribution
        /// </summary>
        /// <param name="that">That distribution</param>
        /// <returns>The maximum difference</returns>
        public virtual double MaxDiff(object that)
        {
            DistributionArray <T> thatd = that as DistributionArray <T>;

            if ((object)thatd == null)
            {
                return(Double.PositiveInfinity);
            }
            return(Distribution.MaxDiff(this.array, thatd.array));
        }
Example #2
0
 /// <summary>
 /// The expected logarithm of that distribution under this distribution.
 /// </summary>
 /// <param name="that">The distribution to take the logarithm of.</param>
 /// <returns><c>sum_x this.Evaluate(x)*Math.Log(that.Evaluate(x))</c></returns>
 /// <remarks>This is also known as the cross entropy.
 /// For a DistributionArray, this specializes to:
 /// <c>sum_i sum_x this[i].Evaluate(x)*Math.Log(that[i].Evaluate(x))</c>
 /// = <c>sum_i this[i].GetAverageLog(that[i])</c>
 /// </remarks>
 public double GetAverageLog(DistributionArray <T> that)
 {
     return(Distribution.GetAverageLog(array, that.array));
 }
Example #3
0
 /// <summary>
 /// Sets the current instance to an array of distributions each element
 /// of which is a weighted sum of the corresponding distributions in two given
 /// distribution arrays
 /// </summary>
 /// <param name="weight1">The first weight</param>
 /// <param name="a">The first distribution array</param>
 /// <param name="weight2">The second weight</param>
 /// <param name="b">The second distribution array</param>
 public void SetToSum(double weight1, DistributionArray <T> a, double weight2, DistributionArray <T> b)
 {
     Distribution.SetToSum(array, weight1, a.array, weight2, b.array);
 }
Example #4
0
 /// <summary>
 /// Sets the current instance to an array of distributions each element
 /// of which is a power of the corresponding element in a source distribution array
 /// </summary>
 /// <param name="a">The source distribution array</param>
 /// <param name="exponent">The exponent</param>
 public void SetToPower(DistributionArray <T> a, double exponent)
 {
     Distribution.SetToPower(array, a.array, exponent);
 }
Example #5
0
 /// <summary>
 /// Sets the current instance to an array of distributions each element
 /// of which is a ratio of the corrresponding distributions in two given
 /// distribution arrays
 /// </summary>
 /// <param name="numerator">The numerator distribution array</param>
 /// <param name="denominator">The denominator distribution array</param>
 public void SetToRatio(DistributionArray <T> numerator, DistributionArray <T> denominator)
 {
     Distribution.SetToRatio(array, numerator.array, denominator.array);
 }
Example #6
0
 /// <summary>
 /// Sets the current instance to an array of distributions each element
 /// of which is a product of the corresponding distributions in two given
 /// distribution arrays
 /// </summary>
 /// <param name="a">The first distribution array</param>
 /// <param name="b">The second distribution array</param>
 public void SetToProduct(DistributionArray <T> a, DistributionArray <T> b)
 {
     Distribution.SetToProduct(array, a.array, b.array);
 }
Example #7
0
 public void SetTo(DistributionArray <T> that)
 {
     base.SetTo(that);
 }