Exemplo n.º 1
0
        public void GenerateTest()
        {
            InverseGaussianDistribution target = new InverseGaussianDistribution(1, 1);

            double[] samples = target.Generate(1000000);

            InverseGaussianDistribution actual = new InverseGaussianDistribution(5, 5);

            actual.Fit(samples);

            Assert.AreEqual(1, actual.Mean, 0.01);
            Assert.AreEqual(1, actual.Shape, 0.01);
        }
Exemplo n.º 2
0
        public void GenerateTest2()
        {
            InverseGaussianDistribution target = new InverseGaussianDistribution(5, 2);

            double[] samples = target.Generate(1000000);

            var actual = InverseGaussianDistribution.Estimate(samples);

            actual.Fit(samples);

            Assert.AreEqual(5, actual.Mean, 0.01);
            Assert.AreEqual(2, actual.Shape, 0.01);
        }
Exemplo n.º 3
0
        public void GenerateTest2()
        {
            Accord.Math.Tools.SetupGenerator(0);

            InverseGaussianDistribution target = new InverseGaussianDistribution(5, 2);

            double[] samples = target.Generate(10000000);

            var actual = InverseGaussianDistribution.Estimate(samples);

            actual.Fit(samples);

            Assert.AreEqual(5, actual.Mean, 1e-3);
            Assert.AreEqual(2, actual.Shape, 1e-3);
        }
Exemplo n.º 4
0
        public void GenerateTest3()
        {
            InverseGaussianDistribution target = new InverseGaussianDistribution(4, 2);

            double[] samples = new double[1000000];
            for (int i = 0; i < samples.Length; i++)
            {
                samples[i] = target.Generate();
            }

            var actual = InverseGaussianDistribution.Estimate(samples);

            actual.Fit(samples);

            Assert.AreEqual(4, actual.Mean, 0.01);
            Assert.AreEqual(2, actual.Shape, 0.01);
        }
Exemplo n.º 5
0
        public void GenerateTest4()
        {
            Accord.Math.Random.Generator.Seed = 0;
            InverseGaussianDistribution target = new InverseGaussianDistribution(0.4, 0.2);

            double[] samples = new double[10000000];
            for (int i = 0; i < samples.Length; i++)
            {
                samples[i] = target.Generate();
            }

            var actual = InverseGaussianDistribution.Estimate(samples);

            actual.Fit(samples);

            Assert.AreEqual(0.4, actual.Mean, 1e-3);
            Assert.AreEqual(0.2, actual.Shape, 1e-3);
        }