public void RandomClassificationEnsembleSelection_Constructor_Number_Of_Availible_Models_Lower_Than_Number_Of_Models_To_Select() { var sut = new RandomClassificationEnsembleSelection( new LogLossClassificationProbabilityMetric(), new MeanProbabilityClassificationEnsembleStrategy(), 5, 1, true); var observations = new ProbabilityPrediction[3][]; observations.Select(t => new ProbabilityPrediction[10]).ToArray(); var targets = new double[10]; sut.Select(observations, targets); }
public void RandomClassificationEnsembleSelection_Select_No_Replacements() { var sut = new RandomClassificationEnsembleSelection(new LogLossClassificationProbabilityMetric(), new MeanProbabilityClassificationEnsembleStrategy(), 3, 10, false); var random = new Random(42); var observations = CreateModelPredictions(random); var targets = Enumerable.Range(0, 10).Select(v => (double)random.Next(1)).ToArray(); var actual = sut.Select(observations, targets); var expected = new int[] { 1, 0, 2 }; CollectionAssert.AreEqual(expected, actual); }