Accord.Tests.Statistics.MultivariateNormalDistributionTest.FitTest C# (CSharp) Method

FitTest() private method

private FitTest ( ) : void
return void
        public void FitTest()
        {
            double[][] observations = 
            {
                new double[] { 0.1000, -0.2000 },
                new double[] { 0.4000,  0.6000 },
                new double[] { 2.0000,  0.2000 },
                new double[] { 2.0000,  0.3000 }
            };

            double[] mean = Measures.Mean(observations, dimension: 0);
            double[][] cov = Measures.Covariance(observations);

            {
                var target = new MultivariateNormalDistribution(2);

                double[] weigths = { 0.25, 0.25, 0.25, 0.25 };

                target.Fit(observations, weigths);

                Assert.IsTrue(Matrix.IsEqual(mean, target.Mean));
                Assert.IsTrue(Matrix.IsEqual(cov, target.Covariance, 1e-10));
            }

            {
                var target = new MultivariateNormalDistribution(2);

                double[] weigths = { 1, 1, 1, 1 };

                target.Fit(observations, weigths);

                Assert.IsTrue(Matrix.IsEqual(mean, target.Mean));
                Assert.IsTrue(Matrix.IsEqual(cov, target.Covariance, 1e-10));
            }
        }