зеркало из https://github.com/dotnet/infer.git
Added GammaPower.GetMode
This commit is contained in:
Родитель
b7ab86af1b
Коммит
8e237a0d02
|
@ -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>
|
||||
|
|
Загрузка…
Ссылка в новой задаче