public void BinaryTreeNumericAttributesDiscreteDependentFeatures()
        {
            // Given
            var dataSet = TestDataBuilder.ReadIrisData();
            var binaryTreeBuilder = new BinaryDecisionTreeModelBuilder(
                new InformationGainRatioCalculator<string>(this.shannonEntropy, this.shannonEntropy as ICategoricalImpurityMeasure<string>),
                new BinarySplitSelectorForCategoricalOutcome(new BinaryDiscreteDataSplitter(), new BinaryNumericDataSplitter(), new ClassBreakpointsNumericSplitFinder()),
                new CategoricalDecisionTreeLeafBuilder());

            // When
            var decisionTree = binaryTreeBuilder.BuildModel(dataSet, "iris_class", null);

            // Then
            Assert.IsNotNull(decisionTree);
        }
        public void Regression_NumericAttrsAndOutcomesOnly_RegularizedRegression()
        {
            // Given
            var randomizer = new Random(3);
            var splitter = new CrossValidator<double>(randomizer);
            var testData = TestDataBuilder.ReadHousingDataNormalizedAttrs();

            var predictor = new DecisionTreePredictor<double>();

            var numericTreeBuilder = new BinaryDecisionTreeModelBuilder(
                new VarianceBasedSplitQualityChecker(),
                new BestSplitSelectorForNumericValues(new BinaryNumericDataSplitter()),
                new RegressionAndModelDecisionTreeLeafBuilder(new RegularizedLinearRegressionModelBuilder(0.005)));

            // When
            var accuracies = splitter.CrossValidate(
                modelBuilder: numericTreeBuilder,
                modelBuilderParams: modelBuilderParams,
                predictor: predictor,
                qualityMeasure: new GoodnessOfFitQualityMeasure(),
                dataFrame: testData,
                dependentFeatureName: "MEDV",
                percetnagOfTrainData: 0.7,
                folds: 15);

            // Then
            var averegeRsquared = accuracies.Select(report => report.Accuracy).Average();
            Assert.IsTrue(averegeRsquared >= 0.6);
        }