Esempio n. 1
0
        public void ClassificationMatrix_ConfusionMatrix()
        {
            var predictions   = new double[] { 0, 1, 2 };
            var targets       = new double[] { 0, 1, 1 };
            var uniqueTargets = predictions.Distinct().ToList();

            var actual   = ClassificationMatrix.ConfusionMatrix(uniqueTargets, targets, predictions);
            var expected = new int[, ] {
                { 1, 0, 0 }, { 0, 1, 1 }, { 0, 0, 0 }
            };

            AssertAreEqual(expected, actual);
        }
        public void ClassificationMatrix_ConfusionMatrix()
        {
            var predictions   = new double[] { 0, 1, 2 };
            var targets       = new double[] { 0, 1, 1 };
            var uniqueTargets = predictions.Distinct().ToList();

            var actual = ClassificationMatrix.ConfusionMatrix(uniqueTargets, targets, predictions);

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

            Assert.AreEqual(expected.Length, actual.Length);
            for (int i = 0; i < expected.Length; i++)
            {
                CollectionAssert.AreEqual(expected[i], actual[i]);
            }
        }