public void TimeSeriesCrossValidation_Validate_InitialTrainingSize_Is_Larger_Than_Obsevations_Length() { var(observations, targets) = DataSetUtilities.LoadDecisionTreeDataSet(); var sut = new TimeSeriesCrossValidation <double>(initialTrainingSize: 300); var timeSeriesPredictions = sut.Validate(new RegressionDecisionTreeLearner(), observations, targets); }
public void TimeSeriesCrossValidation_Validate_Observations_And_Targets_Length_Does_Not_Match() { var(observations, targets) = DataSetUtilities.LoadDecisionTreeDataSet(); targets = targets.Take(100).ToArray(); var sut = new TimeSeriesCrossValidation <double>(initialTrainingSize: 5); var timeSeriesPredictions = sut.Validate(new RegressionDecisionTreeLearner(), observations, targets); }
public void TimeSeriesCrossValidation_Validate_InitialTrainingSize_Is_Larger_Than_Obsevations_Length() { 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 sut = new TimeSeriesCrossValidation <double>(initialTrainingSize: 300); var timeSeriesPredictions = sut.Validate(new RegressionDecisionTreeLearner(), observations, targets); }
public void TimeSeriesCrossValidation_Validate_MaxTrainingSetSize_And_RetrainInterval() { var(observations, targets) = DataSetUtilities.LoadDecisionTreeDataSet(); var sut = new TimeSeriesCrossValidation <double>(initialTrainingSize: 5, maxTrainingSetSize: 30, retrainInterval: 5); var timeSeriesPredictions = sut.Validate(new RegressionDecisionTreeLearner(), observations, targets); var timeSeriesTargets = sut.GetValidationTargets(targets); var metric = new MeanSquaredErrorRegressionMetric(); var error = metric.Error(timeSeriesTargets, timeSeriesPredictions); Assert.AreEqual(0.13010151998135897, error, 0.00001); }
public void TimeSeriesCrossValidation_Validate_MaxTrainingSetSize() { var(observations, targets) = DataSetUtilities.LoadDecisionTreeDataSet(); var sut = new TimeSeriesCrossValidation <double>(initialTrainingSize: 5, maxTrainingSetSize: 10); var timeSeriesPredictions = sut.Validate(new RegressionDecisionTreeLearner(), observations, targets); var timeSeriesTargets = sut.GetValidationTargets(targets); var metric = new MeanSquaredErrorRegressionMetric(); var error = metric.Error(timeSeriesTargets, timeSeriesPredictions); Assert.AreEqual(0.27296549371962692, error, 0.00001); }
public void TimeSeriesCrossValidation_Validate_RetrainInterval() { var(observations, targets) = DataSetUtilities.LoadDecisionTreeDataSet(); var sut = new TimeSeriesCrossValidation <double>(initialTrainingSize: 5, retrainInterval: 5); var learner = new RegressionDecisionTreeLearner(); var timeSeriesPredictions = sut.Validate(learner, observations, targets); var timeSeriesTargets = sut.GetValidationTargets(targets); var metric = new MeanSquaredErrorRegressionMetric(); var error = metric.Error(timeSeriesTargets, timeSeriesPredictions); Assert.AreEqual(0.096346937132994928, error, 0.00001); }
public void TimeSeriesCrossValidation_Validate_MaxTrainingSetSize_And_RetrainInterval() { 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 sut = new TimeSeriesCrossValidation <double>(initialTrainingSize: 5, maxTrainingSetSize: 30, retrainInterval: 5); var timeSeriesPredictions = sut.Validate(new RegressionDecisionTreeLearner(), observations, targets); var timeSeriesTargets = sut.GetValidationTargets(targets); var metric = new MeanSquaredErrorRegressionMetric(); var error = metric.Error(timeSeriesTargets, timeSeriesPredictions); Assert.AreEqual(0.11347313000447182, error, 0.00001); }