コード例 #1
0
        public virtual void TestBulkAdd()
        {
            string expected = "      Guess/Gold      C1      C2    Marg. (Guess)\n" + "              C1      10       5      15\n" + "              C2       2       3       5\n" + "    Marg. (Gold)      12       8\n\n" + "              C1 = 1        prec=0.66667, recall=0.83333, spec=0.375, f1=0.74074\n"
                              + "              C2 = 2        prec=0.6, recall=0.375, spec=0.83333, f1=0.46154\n";
            ConfusionMatrix <int> conf = new ConfusionMatrix <int>(Locale.Us);

            conf.Add(1, 1, 10);
            conf.Add(1, 2, 5);
            conf.Add(2, 1, 2);
            conf.Add(2, 2, 3);
            string result = conf.PrintTable();

            if (echo)
            {
                System.Console.Error.WriteLine(result);
            }
            else
            {
                NUnit.Framework.Assert.AreEqual(expected, result);
            }
        }
コード例 #2
0
        public virtual void TestBasic()
        {
            string expected = "      Guess/Gold      C1      C2      C3    Marg. (Guess)\n" + "              C1       2       0       0       2\n" + "              C2       1       0       0       1\n" + "              C3       0       0       1       1\n"
                              + "    Marg. (Gold)       3       0       1\n\n" + "              C1 = a        prec=1, recall=0.66667, spec=1, f1=0.8\n" + "              C2 = b        prec=0, recall=n/a, spec=0.75, f1=n/a\n" + "              C3 = c        prec=1, recall=1, spec=1, f1=1\n";
            ConfusionMatrix <string> conf = new ConfusionMatrix <string>(Locale.Us);

            conf.Add("a", "a");
            conf.Add("a", "a");
            conf.Add("b", "a");
            conf.Add("c", "c");
            string result = conf.PrintTable();

            if (echo)
            {
                System.Console.Error.WriteLine(result);
            }
            else
            {
                NUnit.Framework.Assert.AreEqual(expected, result);
            }
        }
コード例 #3
0
        public virtual void TestRealLabels()
        {
            string expected = "      Guess/Gold       a       b       c    Marg. (Guess)\n" + "               a       2       0       0       2\n" + "               b       1       0       0       1\n" + "               c       0       0       1       1\n"
                              + "    Marg. (Gold)       3       0       1\n\n" + "               a        prec=1, recall=0.66667, spec=1, f1=0.8\n" + "               b        prec=0, recall=n/a, spec=0.75, f1=n/a\n" + "               c        prec=1, recall=1, spec=1, f1=1\n";
            ConfusionMatrix <string> conf = new ConfusionMatrix <string>(Locale.Us);

            conf.SetUseRealLabels(true);
            conf.Add("a", "a");
            conf.Add("a", "a");
            conf.Add("b", "a");
            conf.Add("c", "c");
            string result = conf.PrintTable();

            if (echo)
            {
                System.Console.Error.WriteLine(result);
            }
            else
            {
                NUnit.Framework.Assert.AreEqual(expected, result);
            }
        }
コード例 #4
0
 public ConfusionGrid(ConfusionMatrix <U> _enclosing)
 {
     this._enclosing = _enclosing;
     EventQueue.InvokeLater(null);
 }