@Test public void testFit() { int sampleSize = 500; Map<Integer, LabeledVector<Double>> sample = new HashMap<>(); for (int i = 0; i < sampleSize; i++) { double x1 = i; double x2 = x1 / 10.0; double x3 = x2 / 10.0; double x4 = x3 / 10.0; sample.put(i, VectorUtils.of(x1, x2, x3, x4).labeled((double) i % 2)); } ArrayList<FeatureMeta> meta = new ArrayList<>(); for (int i = 0; i < 4; i++) meta.add(new FeatureMeta("", i, false)); DatasetTrainer<ModelsComposition, Double> trainer = new RandomForestClassifierTrainer(meta) .withAmountOfTrees(5) .withFeaturesCountSelectionStrgy(x -> 2) .withEnvironmentBuilder(TestUtils.testEnvBuilder()); ModelsComposition mdl = trainer.fit(sample, parts, new LabeledDummyVectorizer<>()); assertTrue(mdl.getPredictionsAggregator() instanceof OnMajorityPredictionsAggregator); assertEquals(5, mdl.getModels().size()); }
@Override public RandomForestClassifierTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) { return (RandomForestClassifierTrainer)super.withEnvironmentBuilder(envBuilder); }
RandomForestClassifierTrainer extends RandomForestTrainer<ObjectHistogram<BootstrappedVector>, GiniHistogram, RandomForestClassifierTrainer> { @Override public RandomForestClassifierTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) { return (RandomForestClassifierTrainer)super.withEnvironmentBuilder(envBuilder); } }
RandomForestClassifierTrainer extends RandomForestTrainer<ObjectHistogram<BootstrappedVector>, GiniHistogram, RandomForestClassifierTrainer> { @Override public RandomForestClassifierTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) { return (RandomForestClassifierTrainer)super.withEnvironmentBuilder(envBuilder); } RandomForestClassifierTrainer(List<FeatureMeta> meta); }
RandomForestClassifierTrainer extends RandomForestTrainer<ObjectHistogram<BootstrappedVector>, GiniHistogram, RandomForestClassifierTrainer> { @Override public RandomForestClassifierTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) { return (RandomForestClassifierTrainer)super.withEnvironmentBuilder(envBuilder); } RandomForestClassifierTrainer(List<FeatureMeta> meta); @Override RandomForestClassifierTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder); }
RandomForestClassifierTrainer extends RandomForestTrainer<ObjectHistogram<BootstrappedVector>, GiniHistogram, RandomForestClassifierTrainer> { @Override public RandomForestClassifierTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) { return (RandomForestClassifierTrainer)super.withEnvironmentBuilder(envBuilder); } RandomForestClassifierTrainer(List<FeatureMeta> meta); @Override RandomForestClassifierTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder);  }