public void LearningCurvesCalculator_Calculate_Sample_Percentage_Too_Low()
        {
            var sut = new LearningCurvesCalculator <double>(new RandomTrainingTestIndexSplitter <double>(0.8, 42),
                                                            new RandomIndexSampler <double>(42),
                                                            new MeanSquaredErrorRegressionMetric(), new double[] { 0.0, 0.8 });

            var observations = new F64Matrix(10, 10);
            var targets      = new double[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

            sut.Calculate(new RegressionDecisionTreeLearner(),
                          observations, targets);
        }
        public void LearningCurvesCalculator_Calculate()
        {
            var sut = new LearningCurvesCalculator <double>(new RandomTrainingTestIndexSplitter <double>(0.8, 42),
                                                            new RandomIndexSampler <double>(42), new MeanSquaredErrorRegressionMetric(), new double[] { 0.2, 0.8 });

            var(observations, targets) = DataSetUtilities.LoadDecisionTreeDataSet();

            var actual = sut.Calculate(new RegressionDecisionTreeLearner(),
                                       observations, targets);

            var expected = new List <LearningCurvePoint>()
            {
                new LearningCurvePoint(32, 0, 0.141565953928265),
                new LearningCurvePoint(128, 0.0, 0.068970597423950036)
            };

            CollectionAssert.AreEqual(expected, actual);
        }
        public void LearningCurvesCalculator_Calculate()
        {
            var sut = new LearningCurvesCalculator <double>(new RandomTrainingTestIndexSplitter <double>(0.8, 42),
                                                            new RandomIndexSampler <double>(42), new MeanSquaredErrorRegressionMetric(), new double[] { 0.2, 0.8 });

            var targetName   = "T";
            var parser       = new CsvParser(() => new StringReader(Resources.DecisionTreeData));
            var observations = parser.EnumerateRows(v => !v.Contains(targetName)).ToF64Matrix();
            var targets      = parser.EnumerateRows(targetName).ToF64Vector();

            var actual = sut.Calculate(new RegressionDecisionTreeLearner(),
                                       observations, targets);

            var expected = new List <LearningCurvePoint>()
            {
                new LearningCurvePoint(32, 0, 0.141565953928265),
                new LearningCurvePoint(128, 0.0, 0.068970597423950036)
            };

            CollectionAssert.AreEqual(expected, actual);
        }