Exemple #1
0
        object ICloneable.Clone()
        {
            DiscreteEnum <TEnum> clone = new DiscreteEnum <TEnum>();

            clone.SetProbs(GetProbs());
            return(clone);
        }
Exemple #2
0
        /// <summary>
        /// Creates a Discrete distribution which allows only one enum value.
        /// </summary>
        /// <param name="value">The allowed value.</param>
        /// <returns></returns>
        public static DiscreteEnum <TEnum> PointMass(TEnum value)
        {
            var d = DiscreteEnum <TEnum> .Uniform();

            ((HasPoint <TEnum>)d).Point = value;
            return(d);
        }
Exemple #3
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.</remarks>
 public double GetAverageLog(DiscreteEnum <TEnum> that)
 {
     return(base.GetAverageLog(that));
 }
Exemple #4
0
 /// <summary>
 /// The log of the integral of the product of this discrete enum and that discrete enum
 /// </summary>
 /// <param name="that">That discrete enum distribution</param>
 /// <returns>The log inner product</returns>
 public double GetLogAverageOf(DiscreteEnum <TEnum> that)
 {
     return(base.GetLogAverageOf(that));
 }
Exemple #5
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(DiscreteEnum <TEnum> that, double power)
 {
     return(base.GetLogAverageOfPower(that, power));
 }
Exemple #6
0
 /// <summary>
 /// Sets the parameters to represent the weighted sum of two discrete enum distributions.
 /// </summary>
 /// <param name="value1">The first discrete enum distribution</param>
 /// <param name="weight1">The first weight</param>
 /// <param name="value2">The second discrete enum distribution</param>
 /// <param name="weight2">The second weight</param>
 public void SetToSum(double weight1, DiscreteEnum <TEnum> value1, double weight2, DiscreteEnum <TEnum> value2)
 {
     base.SetToSum(weight1, value1, weight2, value2);
 }
Exemple #7
0
 /// <summary>
 /// Sets the parameters to represent the power of a discrete enum distributions.
 /// </summary>
 /// <param name="value">The discrete enum distribution</param>
 /// <param name="exponent">The exponent</param>
 public void SetToPower(DiscreteEnum <TEnum> value, double exponent)
 {
     base.SetToPower(value, exponent);
 }
Exemple #8
0
 /// <summary>
 /// Sets the parameters to represent the ratio of two discrete enum distributions.
 /// </summary>
 /// <param name="numerator">The numerator discrete enum distribution</param>
 /// <param name="denominator">The denominator discrete enum distribution</param>
 public void SetToRatio(DiscreteEnum <TEnum> numerator, DiscreteEnum <TEnum> denominator)
 {
     base.SetToRatio(numerator, denominator);
 }
Exemple #9
0
 /// <summary>
 /// Sets the parameters to represent the product of two discrete enum distributions.
 /// </summary>
 /// <param name="a">The first discrete enum distribution</param>
 /// <param name="b">The second discrete enum distribution</param>
 public void SetToProduct(DiscreteEnum <TEnum> a, DiscreteEnum <TEnum> b)
 {
     base.SetToProduct(a, b);
 }
Exemple #10
0
 /// <summary>
 /// Sets the parameters of this instance to the parameters of that instance
 /// </summary>
 /// <param name="value">That instance</param>
 public void SetTo(DiscreteEnum <TEnum> value)
 {
     base.SetTo(value);
 }