当前位置: 首页>>代码示例>>C#>>正文


C# NormalGamma类代码示例

本文整理汇总了C#中NormalGamma的典型用法代码示例。如果您正苦于以下问题:C# NormalGamma类的具体用法?C# NormalGamma怎么用?C# NormalGamma使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NormalGamma类属于命名空间,在下文中一共展示了NormalGamma类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanGetMean

 public void CanGetMean(double meanLocation, double meanScale, double precShape, double precInvScale,
     double meanMean, double meanPrecision)
 {
     NormalGamma ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
     Assert.AreEqual<double>(meanMean, ng.Mean.Mean);
     Assert.AreEqual<double>(meanPrecision, ng.Mean.Precision);
 }
开发者ID:xmap2008,项目名称:mathnet-numerics,代码行数:7,代码来源:NormalGammaTests.cs

示例2: CanCreateNormalGamma

        public void CanCreateNormalGamma(double meanLocation, double meanScale, double precShape, double precInvScale)
        {
            var ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);

            Assert.AreEqual(meanLocation, ng.MeanLocation);
            Assert.AreEqual(meanScale, ng.MeanScale);
            Assert.AreEqual(precShape, ng.PrecisionShape);
            Assert.AreEqual(precInvScale, ng.PrecisionInverseScale);
        }
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:9,代码来源:NormalGammaTests.cs

示例3: ValidateVariance

 public void ValidateVariance(double meanLocation, double meanScale, double precShape, double precInvScale)
 {
     var ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
     var x = precInvScale / (meanScale * (precShape - 1));
     var t = precShape / Math.Sqrt(precInvScale);
     Assert.AreEqual(x, ng.Variance.Mean);
     Assert.AreEqual(t, ng.Variance.Precision);
 }
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:8,代码来源:NormalGammaTests.cs

示例4: 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);
        }
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:31,代码来源:NormalGammaTests.cs

示例5: 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);
 }
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:7,代码来源:NormalGammaTests.cs

示例6: HasRandomSource

 public void HasRandomSource()
 {
     var ng = new NormalGamma(0.0, 1.0, 1.0, 1.0);
     Assert.IsNotNull(ng.RandomSource);
 }
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:5,代码来源:NormalGammaTests.cs

示例7: CanGetPrecisionShape

 public void CanGetPrecisionShape(double meanLocation, double meanScale, double precShape, double precInvScale)
 {
     var ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
     Assert.AreEqual(precShape, ng.PrecisionShape);
 }
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:5,代码来源:NormalGammaTests.cs

示例8: CanGetMeanMarginal

 public void CanGetMeanMarginal(double meanLocation, double meanScale, double precShape, double precInvScale, double meanMarginalMean, double meanMarginalScale, double meanMarginalDoF)
 {
     var ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
     var mm = ng.MeanMarginal();
     Assert.AreEqual(meanMarginalMean, mm.Location);
     Assert.AreEqual(meanMarginalScale, mm.Scale);
     Assert.AreEqual(meanMarginalDoF, mm.DegreesOfFreedom);
 }
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:8,代码来源:NormalGammaTests.cs

示例9: CanGetDensityAndDensityLn

 public void CanGetDensityAndDensityLn(double meanLocation, double meanScale, double precShape, double precInvScale)
 {
     var ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
     Assert.AreEqual(ng.DensityLn(meanLocation, precShape), Math.Log(ng.Density(meanLocation, precShape)), 1e-14);
 }
开发者ID:hickford,项目名称:mathnet-numerics-native,代码行数:5,代码来源:NormalGammaTests.cs

示例10: CanGetMean

 public void CanGetMean([Values(0.0, 10.0, 10.0)] double meanLocation, [Values(1.0, 1.0, 1.0)] double meanScale, [Values(1.0, 2.0, 2.0)] double precShape, [Values(1.0, 2.0, Double.PositiveInfinity)] double precInvScale, [Values(0.0, 10.0, 10.0)] double meanMean, [Values(1.0, 1.0, 2.0)] double meanPrecision)
 {
     var ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
     Assert.AreEqual(meanMean, ng.Mean.Mean);
     Assert.AreEqual(meanPrecision, ng.Mean.Precision);
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:6,代码来源:NormalGammaTests.cs

示例11: CanSetPrecisionShape

 public void CanSetPrecisionShape(double meanLocation, double meanScale, double precShape, double precInvScale)
 {
     NormalGamma ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
     ng.PrecisionShape = 5.0;
     Assert.AreEqual<double>(meanLocation, ng.MeanLocation);
     Assert.AreEqual<double>(meanScale, ng.MeanScale);
     Assert.AreEqual<double>(5.0, ng.PrecisionShape);
     Assert.AreEqual<double>(precInvScale, ng.PrecisionInverseScale);
 }
开发者ID:xmap2008,项目名称:mathnet-numerics,代码行数:9,代码来源:NormalGammaTests.cs

示例12: CanSetRandomSource

 public void CanSetRandomSource()
 {
     NormalGamma ng = new NormalGamma(0.0, 1.0, 1.0, 1.0);
     ng.RandomSource = new Random();
 }
开发者ID:xmap2008,项目名称:mathnet-numerics,代码行数:5,代码来源:NormalGammaTests.cs

示例13: CanGetMeanScale

 public void CanGetMeanScale(double meanLocation, double meanScale, double precShape, double precInvScale)
 {
     NormalGamma ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
     AssertEx.AreEqual<double>(meanScale, ng.MeanScale);
 }
开发者ID:hany-abdelrahman,项目名称:mathnet-numerics,代码行数:5,代码来源:NormalGammaTests.cs

示例14: CanGetMeanLocation

 public void CanGetMeanLocation([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 precInvScale)
 {
     var ng = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
     Assert.AreEqual(meanLocation, ng.MeanLocation);
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:5,代码来源:NormalGammaTests.cs

示例15: ValidateVariance

 public void ValidateVariance([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 x = precInvScale / (meanScale * (precShape - 1));
     var t = precShape / Math.Sqrt(precInvScale);
     Assert.AreEqual(x, ng.Variance.Mean);
     Assert.AreEqual(t, ng.Variance.Precision);
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:NormalGammaTests.cs


注:本文中的NormalGamma类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。