本文整理汇总了C#中NormalGamma.PrecisionMarginal方法的典型用法代码示例。如果您正苦于以下问题:C# NormalGamma.PrecisionMarginal方法的具体用法?C# NormalGamma.PrecisionMarginal怎么用?C# NormalGamma.PrecisionMarginal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NormalGamma
的用法示例。
在下文中一共展示了NormalGamma.PrecisionMarginal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SamplesFollowsCorrectDistribution
public void SamplesFollowsCorrectDistribution()
{
var cd = new NormalGamma(1.0, 4.0, 3.0, 3.5);
// Sample from the distribution.
var samples = cd.Samples().Take(CommonDistributionTests.NumberOfTestSamples).ToArray();
// Extract the mean and precisions.
var means = samples.Select(mp => mp.Mean);
var precs = samples.Select(mp => mp.Precision);
var meanMarginal = cd.MeanMarginal();
var precMarginal = cd.PrecisionMarginal();
// Check the precision distribution.
CommonDistributionTests.VapnikChervonenkisTest(
CommonDistributionTests.Error,
CommonDistributionTests.ErrorProbability,
precs,
precMarginal);
// Check the mean distribution.
CommonDistributionTests.VapnikChervonenkisTest(
CommonDistributionTests.Error,
CommonDistributionTests.ErrorProbability,
means,
meanMarginal);
}
示例2: CanGetPrecisionMarginal
public void CanGetPrecisionMarginal(double meanLocation, double meanScale, double precShape, double precInvScale)
{
var ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
var pm = ng.PrecisionMarginal();
Assert.AreEqual(precShape, pm.Shape);
Assert.AreEqual(precInvScale, pm.InvScale);
}
示例3: SampleFollowsCorrectDistribution
public void SampleFollowsCorrectDistribution()
{
var cd = new NormalGamma(1.0, 4.0, 7.0, 3.5);
// Sample from the distribution.
var samples = new MeanPrecisionPair[CommonDistributionTests.NumberOfTestSamples];
for (var i = 0; i < CommonDistributionTests.NumberOfTestSamples; i++)
{
samples[i] = cd.Sample();
}
// Extract the mean and precisions.
var means = samples.Select(mp => mp.Mean);
var precs = samples.Select(mp => mp.Precision);
var meanMarginal = cd.MeanMarginal();
var precMarginal = cd.PrecisionMarginal();
// Check the precision distribution.
CommonDistributionTests.VapnikChervonenkisTest(
CommonDistributionTests.Error,
CommonDistributionTests.ErrorProbability,
precs,
precMarginal);
// Check the mean distribution.
CommonDistributionTests.VapnikChervonenkisTest(
CommonDistributionTests.Error,
CommonDistributionTests.ErrorProbability,
means,
meanMarginal);
}
示例4: CanGetPrecisionMarginal
public void CanGetPrecisionMarginal([Values(0.0, 10.0)] double meanLocation, [Values(1.0, 2.0)] double meanScale, [Values(1.0, 2.0)] double precShape, [Values(1.0, 2.0, Double.PositiveInfinity)] double precInvScale)
{
var ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
var pm = ng.PrecisionMarginal();
Assert.AreEqual(precShape, pm.Shape);
Assert.AreEqual(precInvScale, pm.InvScale);
}