Ejemplo n.º 1
0
        public void ExtendTest2()
        {
            int[][] data =
            {
                new int[] { 0, 2, 4 },
                new int[] { 1, 1, 2 },
            };

            int labelColumn    = 0;
            int positiveColumn = 1;
            int negativeColumn = 2;

            int[][] expected =
            {
                // For label 0
                new int[] { 0, 1 }, // Two positive cases
                new int[] { 0, 1 },

                new int[] { 0, 0 }, // Four negative cases
                new int[] { 0, 0 },
                new int[] { 0, 0 },
                new int[] { 0, 0 },

                // For label 1
                new int[] { 1, 1 }, // One positive case
                new int[] { 1, 0 }, // Three negative cases
                new int[] { 1, 0 },
            };

            int[][] actual = Tools.Expand(data, labelColumn, positiveColumn, negativeColumn);

            Assert.IsTrue(expected.IsEqual(actual));
        }
Ejemplo n.º 2
0
        public void ExtendTest()
        {
            int[,] summary =
            {
                { 1, 4, 5 },
                { 2, 1, 3 },
            };

            int[] group     = summary.GetColumn(0);
            int[] positives = summary.GetColumn(1);
            int[] negatives = summary.GetColumn(2);

            int[][] expected =
            {
                new int[] { 1, 1 },
                new int[] { 1, 1 },
                new int[] { 1, 1 },
                new int[] { 1, 1 },
                new int[] { 1, 0 },
                new int[] { 1, 0 },
                new int[] { 1, 0 },
                new int[] { 1, 0 },
                new int[] { 1, 0 },
                new int[] { 2, 1 },
                new int[] { 2, 0 },
                new int[] { 2, 0 },
                new int[] { 2, 0 },
            };

            int[][] actual;
            actual = Tools.Expand(group, positives, negatives);
            Assert.IsTrue(Matrix.IsEqual(expected, actual));
        }