Accord.Tests.Statistics.MultivariateMixtureDistributionTest.DistributionFunctionTestPerComponent C# (CSharp) Method

DistributionFunctionTestPerComponent() private method

private DistributionFunctionTestPerComponent ( ) : void
return void
        public void DistributionFunctionTestPerComponent()
        {
            MultivariateNormalDistribution[] components = new MultivariateNormalDistribution[2];
            components[0] = new MultivariateNormalDistribution(new double[] { 2 }, new double[,] { { 1 } });
            components[1] = new MultivariateNormalDistribution(new double[] { 5 }, new double[,] { { 1 } });

            double[] coefficients = { 0.3, 0.7 };
            var mixture = new MultivariateMixture<MultivariateNormalDistribution>(coefficients, components);

            double[] x = { 1.2 };

            double expected =
                mixture.DistributionFunction(0, x) +
                mixture.DistributionFunction(1, x);

            double actual = mixture.DistributionFunction(x);

            Assert.AreEqual(expected, actual);
        }