public void BalancedBinaryClassificationRandomForestLearnerThrowsForWrongLabel( double firstLabel, double secondLabel, double thirdLabel, double fourthLabel) { var trainDataObservations = new F64Matrix( new[] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, }, 4, 2); var trainDataLabels = new[] { firstLabel, secondLabel, thirdLabel, fourthLabel }; var learner = new BalancedBinaryClassificationRandomForestLearner(numberOfThreads: 1); Assert.Throws <NotSupportedException>(() => learner.Learn(trainDataObservations, trainDataLabels)); }
public void BalancedBinaryClassificationRandomForestLearnerThrowsAtNanInLabels() { var trainDataObservations = new F64Matrix( new[] { 1.0, 2.0, 3.0, 4.0, }, 2, 2); var trainDataLabels = new[] { 0.0, double.NaN }; var learner = new BalancedBinaryClassificationRandomForestLearner(numberOfThreads: 1); Assert.Throws <ArgumentOutOfRangeException>(() => learner.Learn(trainDataObservations, trainDataLabels)); }
public void BalancedBinaryClassificationRandomForestLearnerDoesNotThrowForCorrectLabel(double firstLabel, double secondLabel) { var trainDataObservations = new F64Matrix( new[] { 1.0, 2.0, 3.0, 4.0, }, 2, 2); var trainDataLabels = new[] { firstLabel, secondLabel }; var learner = new BalancedBinaryClassificationRandomForestLearner(numberOfThreads: 1); var model = learner.Learn(trainDataObservations, trainDataLabels); model.Predict(trainDataObservations); }
public void BalancedBinaryClassificationRandomForestLearnerDoesNotThrowAtNanInObservations() { var trainDataObservations = new F64Matrix( new[] { 1.0, 2.0, double.NaN, double.NaN, }, 2, 2); var trainDataLabels = new[] { 0.0, 1.0 }; var learner = new BalancedBinaryClassificationRandomForestLearner(numberOfThreads: 1); var model = learner.Learn(trainDataObservations, trainDataLabels); model.Predict(trainDataObservations); }