Accord.Tests.Statistics.IndependentTest.FittingOptionsTest C# (CSharp) Метод

FittingOptionsTest() приватный Метод

private FittingOptionsTest ( ) : void
Результат void
        public void FittingOptionsTest()
        {
            double[][] data1 =
            {
                new double[] { 0, 8 },
                new double[] { 0, 6 },
                new double[] { 0, 7 },
                new double[] { 0, 9 },
            };

            double[][] data2 =
            {
                new double[] { 8, 0 },
                new double[] { 6, 0 },
                new double[] { 7, 0 },
                new double[] { 9, 0 },
            };


            var p1 = new NormalDistribution(0, 1);
            var p2 = new NormalDistribution(0, 1);

            {
                Independent<NormalDistribution> target = new Independent<NormalDistribution>(p1, p2);

                target.Fit(data1, new IndependentOptions()
                {
                    InnerOption = new NormalOptions()
                    {
                        Regularization = 1e-5
                    }
                });

                Assert.AreEqual(0.00, target.Mean[0]);
                Assert.AreEqual(7.50, target.Mean[1]);

                Assert.AreEqual(1e-5, target.Variance[0]);
                Assert.AreEqual(1.66666, target.Variance[1], 1e-5);
            }

            {
                Independent<NormalDistribution> target = new Independent<NormalDistribution>(p1, p2);

                target.Fit(data2, new IndependentOptions()
                {
                    InnerOption = new NormalOptions()
                    {
                        Regularization = 1e-5
                    }
                });

                Assert.AreEqual(7.5, target.Mean[0]);
                Assert.AreEqual(0, target.Mean[1]);

                Assert.AreEqual(1.66666, target.Variance[0], 1e-5);
                Assert.AreEqual(1e-5, target.Variance[1]);
            }
        }