This commit is contained in:
Tom Minka 2019-06-07 20:49:23 +01:00
Родитель b7ab86af1b
Коммит 8e237a0d02
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -42,7 +42,7 @@ namespace Microsoft.ML.Probabilistic.Distributions
Sampleable<double>, CanGetMean<double>, CanGetVariance<double>,
CanGetMeanAndVarianceOut<double, double>, CanSetMeanAndVariance<double, double>,
CanGetLogAverageOf<GammaPower>, CanGetLogAverageOfPower<GammaPower>,
CanGetAverageLog<GammaPower>, CanGetLogNormalizer
CanGetAverageLog<GammaPower>, CanGetLogNormalizer, CanGetMode<double>
{
/// <summary>
/// Rate parameter for the distribution
@ -279,6 +279,17 @@ namespace Microsoft.ML.Probabilistic.Distributions
}
}
/// <summary>
/// Returns x where GetLogProb(x) is highest.
/// </summary>
/// <returns></returns>
public double GetMode()
{
if (Power == 0.0) return 1.0;
else if (IsPointMass) return Point;
else return Math.Pow((Shape - Power) / Rate, Power);
}
/// <summary>
/// Compute the probability that a sample from this distribution is less than x.
/// </summary>