A program to recognize and reward our most engaged community members
bootstrapping.setParameter(BootstrappingOperator.PARAMETER_SAMPLE_RATIO, "1.0")
public class RandomForestLearner extends RandomTreeLearner { /** The parameter name for the number of trees. */ public static final String PARAMETER_NUMBER_OF_TREES = "number_of_trees"; public RandomForestLearner(OperatorDescription description) { super(description); }@Override public Class<? extends PredictionModel> getModelClass() { return RandomForestModel.class; }@Override public Model learn(ExampleSet exampleSet) throws OperatorException { BootstrappingOperator bootstrapping = null; try { bootstrapping = OperatorService.createOperator(BootstrappingOperator.class); bootstrapping.setParameter(BootstrappingOperator.PARAMETER_USE_WEIGHTS, "false"); bootstrapping.setParameter(BootstrappingOperator.PARAMETER_SAMPLE_RATIO, "1.0"); } catch (OperatorCreationException e) { throw new OperatorException(getName() + ": cannot construct random tree learner: " + e.getMessage()); } // learn base models List<TreeModel> baseModels = new LinkedList<TreeModel>(); int numberOfTrees = getParameterAsInt(PARAMETER_NUMBER_OF_TREES); for (int i = 0; i < numberOfTrees; i++) { TreeModel model = (TreeModel)super.learn(bootstrapping.apply(exampleSet)); model.setSource(getName()); baseModels.add(model); } // create and return model return new RandomForestModel(exampleSet, baseModels); }
it seems there is bootrapping implemented, however the sample ratio is set to 1.0 and the RandomForest operator does not offer the according parameter to adjust this ratio. Does this mean that all trees are always grown on the whole example set (thus no bootstrapping)?