Documentation of 'Catalano.MachineLearning.Regression.RegressionTrees.Learning.GradientBoostingTree' Java class
GradientBoostingTree
Catalano.MachineLearning.Regression.RegressionTrees.Learning

Class GradientBoostingTree

  • All Implemented Interfaces:
    IRegression, java.io.Serializable, java.lang.Cloneable


    public class GradientBoostingTree
    extends java.lang.Object
    implements IRegression, java.io.Serializable
    Gradient boosting for regression. Gradient boosting is typically used with decision trees (especially CART regression trees) of a fixed size as base learners. For this special case Friedman proposes a modification to gradient boosting method which improves the quality of fit of each base learner.

    Generic gradient boosting at the t-th step would fit a regression tree to pseudo-residuals. Let J be the number of its leaves. The tree partitions the input space into J disjoint regions and predicts a constant value in each region. The parameter J controls the maximum allowed level of interaction between variables in the model. With J = 2 (decision stumps), no interaction between variables is allowed. With J = 3 the model may include effects of the interaction between up to two variables, and so on. Hastie et al. comment that typically 4 ≤ J ≤ 8 work well for boosting and results are fairly insensitive to the choice of in this range, J = 2 is insufficient for many applications, and J > 10 is unlikely to be required.

    Fitting the training set too closely can lead to degradation of the model's generalization ability. Several so-called regularization techniques reduce this over-fitting effect by constraining the fitting procedure. One natural regularization parameter is the number of gradient boosting iterations T (i.e. the number of trees in the model when the base learner is a decision tree). Increasing T reduces the error on training set, but setting it too high may lead to over-fitting. An optimal value of T is often selected by monitoring prediction error on a separate validation data set.

    Another regularization approach is the shrinkage which times a parameter η (called the "learning rate") to update term. Empirically it has been found that using small learning rates (such as η < 0.1) yields dramatic improvements in model's generalization ability over gradient boosting without shrinking (η = 1). However, it comes at the price of increasing computational time both during training and prediction: lower learning rate requires more iterations.

    Soon after the introduction of gradient boosting Friedman proposed a minor modification to the algorithm, motivated by Breiman's bagging method. Specifically, he proposed that at each iteration of the algorithm, a base learner should be fit on a subsample of the training set drawn at random without replacement. Friedman observed a substantional improvement in gradient boosting's accuracy with this modification.

    Subsample size is some constant fraction f of the size of the training set. When f = 1, the algorithm is deterministic and identical to the one described above. Smaller values of f introduce randomness into the algorithm and help prevent over-fitting, acting as a kind of regularization. The algorithm also becomes faster, because regression trees have to be fit to smaller datasets at each iteration. Typically, f is set to 0.5, meaning that one half of the training set is used to build each base learner.

    Also, like in bagging, sub-sampling allows one to define an out-of-bag estimate of the prediction performance improvement by evaluating predictions on those observations which were not used in the building of the next base learner. Out-of-bag estimates help avoid the need for an independent validation dataset, but often underestimate actual performance improvement and the optimal number of iterations.

    Gradient tree boosting implementations often also use regularization by limiting the minimum number of observations in trees' terminal nodes. It's used in the tree building process by ignoring any splits that lead to nodes containing fewer than this number of training set instances. Imposing this limit helps to reduce variance in predictions at leaves.

    References

    1. J. H. Friedman. Greedy Function Approximation: A Gradient Boosting Machine, 1999.
    2. J. H. Friedman. Stochastic Gradient Boosting, 1999.
    See Also:
    Serialized Form
    • Constructor Detail

      • GradientBoostingTree

        public GradientBoostingTree()
        Initialize a new instance of the GradientBoostingTree class.
      • GradientBoostingTree

        public GradientBoostingTree(int T)
        Initialize a new instance of the GradientBoostingTree class.
        Parameters:
        T - Number of trees.
      • GradientBoostingTree

        public GradientBoostingTree(int T,
                                    int J)
        Initialize a new instance of the GradientBoostingTree class.
        Parameters:
        T - Number of trees.
        J - Number of leafs in each tree.
      • GradientBoostingTree

        public GradientBoostingTree(int T,
                                    int J,
                                    GradientBoostingTree.Loss loss)
        Initialize a new instance of the GradientBoostingTree class.
        Parameters:
        T - Number of trees.
        J - Number of leafs in each tree.
        loss - Regression loss function.
      • GradientBoostingTree

        public GradientBoostingTree(int T,
                                    int J,
                                    GradientBoostingTree.Loss loss,
                                    double shrinkage)
        Initialize a new instance of the GradientBoostingTree class.
        Parameters:
        T - Number of trees.
        J - Number of leafs in each tree.
        loss - Regression loss function.
        shrinkage - Shrinkage parameter in (0, 1] controls the learning rate of procedure.
      • GradientBoostingTree

        public GradientBoostingTree(int T,
                                    int J,
                                    GradientBoostingTree.Loss loss,
                                    double shrinkage,
                                    double f)
        Initialize a new instance of the GradientBoostingTree class.
        Parameters:
        T - Number of trees.
        J - Number of leafs in each tree.
        loss - Regression loss function.
        shrinkage - Shrinkage parameter in (0, 1] controls the learning rate of procedure.
        f - Sampling rate for stochastic tree boosting.
      • GradientBoostingTree

        public GradientBoostingTree(DecisionVariable[] attributes)
        Initialize a new instance of the GradientBoostingTree class.
        Parameters:
        attributes - Attributes.
      • GradientBoostingTree

        public GradientBoostingTree(DecisionVariable[] attributes,
                                    int T)
        Initialize a new instance of the GradientBoostingTree class.
        Parameters:
        attributes - Attributes.
        T - Number of trees.
      • GradientBoostingTree

        public GradientBoostingTree(DecisionVariable[] attributes,
                                    int T,
                                    int J)
        Initialize a new instance of the GradientBoostingTree class.
        Parameters:
        attributes - Attributes.
        T - Number of trees.
        J - Number of leafs in each tree.
      • GradientBoostingTree

        public GradientBoostingTree(DecisionVariable[] attributes,
                                    int T,
                                    int J,
                                    GradientBoostingTree.Loss loss)
        Initialize a new instance of the GradientBoostingTree class.
        Parameters:
        attributes - Attributes.
        T - Number of trees.
        J - Number of leafs in each tree.
        loss - Regression loss function.
      • GradientBoostingTree

        public GradientBoostingTree(DecisionVariable[] attributes,
                                    int T,
                                    int J,
                                    GradientBoostingTree.Loss loss,
                                    double shrinkage)
        Initialize a new instance of the GradientBoostingTree class.
        Parameters:
        attributes - Attributes.
        T - Number of trees.
        J - Number of leafs in each tree.
        loss - Regression loss function.
        shrinkage - Shrinkage parameter in (0, 1] controls the learning rate of procedure.
      • GradientBoostingTree

        public GradientBoostingTree(DecisionVariable[] attributes,
                                    int T,
                                    int J,
                                    GradientBoostingTree.Loss loss,
                                    double shrinkage,
                                    double f)
        Constructor. Learns a gradient tree boosting for regression.
        Parameters:
        attributes - the attribute properties.
        T - the number of iterations (trees).
        J - the number of leaves in each tree.
        loss - loss function for regression. By default, least absolute deviation is employed for robust regression.
        shrinkage - the shrinkage parameter in (0, 1] controls the learning rate of procedure.
        f - the sampling fraction for stochastic tree boosting.
    • Method Detail

      • Learn

        public void Learn(double[][] input,
                          double[] output)
        Description copied from interface: IRegression
        Learn.
        Specified by:
        Learn in interface IRegression
        Parameters:
        input - Input.
        output - Output.
      • importance

        public double[] importance()
        Returns the variable importance. Every time a split of a node is made on variable the impurity criterion for the two descendant nodes is less than the parent node. Adding up the decreases for each individual variable over all trees in the forest gives a simple measure of variable importance.
        Returns:
        the variable importance
      • getSamplingRate

        public double getSamplingRate()
        Returns the sampling rate for stochastic gradient tree boosting.
        Returns:
        the sampling rate for stochastic gradient tree boosting.
      • getNumLeaves

        public int getNumLeaves()
        Returns the (maximum) number of leaves in decision tree.
        Returns:
        the (maximum) number of leaves in decision tree.
      • getLossFunction

        public GradientBoostingTree.Loss getLossFunction()
        Returns the loss function.
        Returns:
        the loss function.
      • size

        public int size()
        Returns the number of trees in the model.
        Returns:
        the number of trees in the model
      • trim

        public void trim(int T)
        Trims the tree model set to a smaller size in case of over-fitting. Or if extra decision trees in the model don't improve the performance, we may remove them to reduce the model size and also improve the speed of prediction.
        Parameters:
        T - the new (smaller) size of tree model set.
      • Predict

        public double Predict(double[] feature)
        Description copied from interface: IRegression
        Predict.
        Specified by:
        Predict in interface IRegression
        Parameters:
        feature - Feature.
        Returns:
        Value.
      • clone

        public IRegression clone()
        Description copied from interface: IRegression
        Clone of the object.
        Specified by:
        clone in interface IRegression
        Overrides:
        clone in class java.lang.Object
        Returns:
        A new copy of the object.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.