Class RandomForest.Trainer

    • Constructor Detail

      • Trainer

        public Trainer​(int ntrees)
        Constructor.
        Parameters:
        ntrees - the number of trees.
      • Trainer

        public Trainer​(Attribute[] attributes,
                       int ntrees)
        Constructor.
        Parameters:
        attributes - the attributes of independent variable.
        ntrees - the number of trees.
    • Method Detail

      • setNumTrees

        public RandomForest.Trainer setNumTrees​(int ntrees)
        Sets the number of trees in the random forest.
        Parameters:
        ntrees - the number of trees.
      • setNumRandomFeatures

        public RandomForest.Trainer setNumRandomFeatures​(int mtry)
        Sets the number of random selected features for splitting.
        Parameters:
        mtry - the number of random selected features to be used to determine the decision at a node of the tree. p/3 seems to give generally good performance, where p is the number of variables.
      • setMaxNodes

        public RandomForest.Trainer setMaxNodes​(int maxNodes)
        Sets the maximum number of leaf nodes.
        Parameters:
        maxNodes - the maximum number of leaf nodes.
      • setNodeSize

        public RandomForest.Trainer setNodeSize​(int nodeSize)
        Sets the minimum size of leaf nodes.
        Parameters:
        nodeSize - the number of instances in a node below which the tree will not split.
      • setSamplingRates

        public RandomForest.Trainer setSamplingRates​(double subsample)
        Sets the sampling rate.
        Parameters:
        subsample - the sampling rate.
      • train

        public RandomForest train​(double[][] x,
                                  double[] y)
        Description copied from class: RegressionTrainer
        Learns a regression model with given training data.
        Specified by:
        train in class RegressionTrainer<double[]>
        Parameters:
        x - the training instances.
        y - the training response values.
        Returns:
        a trained regression model.