示例#1
0
        public void ProportionsTest()
        {
            int[,] summary =
            {
                { 1, 4, 5 },
                { 2, 1, 3 },
            };

            double[,] probabilities =
            {
                { 1, 4.0 / (4 + 5) },
                { 2, 1.0 / (1 + 3) },
            };

            int[]    positives = summary.GetColumn(1);
            int[]    negatives = summary.GetColumn(2);
            double[] expected  = probabilities.GetColumn(1);
            double[] actual;

            actual = Tools.Proportions(positives, negatives);
            Assert.IsTrue(Matrix.IsEqual(expected, actual, 0.000000001));
        }