Пример #1
0
        static void Main(string[] args)
        {
            List <PointXD> data = Read("test.txt");
            PointXD        test = new PointXD(null, 6.3, 2.7, 5.5, 2.1);

            DecisionTree tree = DecisionTree.Build(data);

            tree.Print();
            string winnerClass = MakeDecision(tree, test);

            Console.WriteLine("Found class: " + winnerClass);
            Console.WriteLine();

            // пример из методички
            data = Read("test2.txt");
            test = new PointXD(null, "<=30", "средний", "да", "хороший");
            tree = DecisionTree.Build(data);
            tree.Print();
            winnerClass = MakeDecision(tree, test);
            Console.WriteLine("Found class: " + winnerClass);
        }
Пример #2
0
 private static string MakeDecision(DecisionTree tree, PointXD test) => tree.Go(test);