コード例 #1
0
        public void SampleArrayTest()
        {
            var normal = new Normal(0.0, 1.0);
            var rnd    = new MersenneTwister();

            var ms = new MetropolisHastingsSampler <double>(0.2, normal.Density, (x, y) => (new Normal(x, 0.1)).Density(y), x => Normal.Sample(rnd, x, 0.1), 10)
            {
                RandomSource = rnd
            };

            ms.Sample(5);
        }
コード例 #2
0
        public void SampleTest()
        {
            var normal = new Normal(0.0, 1.0);
            var rnd = new MersenneTwister();

            var ms = new MetropolisHastingsSampler<double>(0.2, normal.Density, (x, y) => (new Normal(x, 0.1)).Density(y), x => Normal.Sample(rnd, x, 0.1), 10)
                     {
                         RandomSource = rnd
                     };

            ms.Sample();
        }
コード例 #3
0
        public void SampleArrayTest()
        {
            var normal = new Normal(0.0, 1.0);
            var rnd    = new SystemRandomSource(1);

            var ms = new MetropolisHastingsSampler <double>(0.2, normal.Density, (x, y) => Normal.PDF(x, 0.1, y), x => Normal.Sample(rnd, x, 0.1), 10)
            {
                RandomSource = rnd
            };

            ms.Sample(5);
        }
コード例 #4
0
        public void SampleTest()
        {
            var normal = new Normal(0.0, 1.0);
            var rnd = new SystemRandomSource(1);

            var ms = new MetropolisHastingsSampler<double>(0.2, normal.Density, (x, y) => Normal.PDF(x, 0.1, y), x => Normal.Sample(rnd, x, 0.1), 10)
                {
                    RandomSource = rnd
                };

            ms.Sample();
        }