• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# NormalGamma类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


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


示例17: CanGetMeanMarginal

 public void CanGetMeanMarginal([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 meanMarginalMean, [Values(1.0, 1.0, 0.5)] double meanMarginalScale, [Values(2.0, 4.0, Double.PositiveInfinity)] 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:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:NormalGammaTests.cs


示例18: NormalGammaConstructorFailsWithInvalidParams

 public void NormalGammaConstructorFailsWithInvalidParams(double meanLocation, double meanScale, double precShape, double precInvScale)
 {
     var nb = new NormalGamma(meanLocation, meanScale, precShape, precInvScale);
 }
开发者ID:xmap2008,项目名称:mathnet-numerics,代码行数:4,代码来源:NormalGammaTests.cs


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


示例20: CanGetMeanLocation

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# NormalizationAction类代码示例发布时间:2022-05-24
下一篇:
C# NormalDistribution类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap