public void BestFirstTreeBuilder_Build_Leaf_Nodes_4()
        {
            var(observations, targets) = DataSetUtilities.LoadGlassDataSet();

            var sut = new DecisionTreeLearner(new BestFirstTreeBuilder(2000, 4, observations.ColumnCount, 0.000001, 42,
                                                                       new OnlyUniqueThresholdsSplitSearcher(1), new GiniClassificationImpurityCalculator()));

            var model = new ClassificationDecisionTreeModel(sut.Learn(observations, targets));

            var predictions = model.Predict(observations);

            var evaluator = new TotalErrorClassificationMetric <double>();
            var actual    = evaluator.Error(targets, predictions);

            Assert.AreEqual(0.37383177570093457, actual, 0.00001);
        }
        public void BestFirstTreeBuilder_Build_Leaf_Nodes_4()
        {
            var parser       = new CsvParser(() => new StringReader(Resources.Glass));
            var observations = parser.EnumerateRows(v => v != "Target").ToF64Matrix();
            var targets      = parser.EnumerateRows("Target").ToF64Vector();
            var rows         = targets.Length;

            var sut = new DecisionTreeLearner(new BestFirstTreeBuilder(2000, 4, observations.ColumnCount, 0.000001, 42,
                                                                       new OnlyUniqueThresholdsSplitSearcher(1), new GiniClassificationImpurityCalculator()));

            var model = new ClassificationDecisionTreeModel(sut.Learn(observations, targets));

            var predictions = model.Predict(observations);

            var evaluator = new TotalErrorClassificationMetric <double>();
            var actual    = evaluator.Error(targets, predictions);

            Assert.AreEqual(0.37383177570093457, actual, 0.00001);
        }