Efficient non-greedy optimization of decision trees

11/12/2015 ∙ by Mohammad Norouzi, et al. ∙ 0

Decision trees and randomized forests are widely used in computer vision and machine learning. Standard algorithms for decision tree induction optimize the split functions one node at a time according to some splitting criteria. This greedy procedure often leads to suboptimal trees. In this paper, we present an algorithm for optimizing the split functions at all levels of the tree jointly with the leaf parameters, based on a global objective. We show that the problem of finding optimal linear-combination (oblique) splits for decision trees is related to structured prediction with latent variables, and we formulate a convex-concave upper bound on the tree's empirical loss. The run-time of computing the gradient of the proposed surrogate objective with respect to each training exemplar is quadratic in the the tree depth, and thus training deep trees is feasible. The use of stochastic gradient descent for optimization enables effective training with large datasets. Experiments on several classification benchmarks demonstrate that the resulting non-greedy decision trees outperform greedy decision tree baselines.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

Code Repositories

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Decision trees and forests [6, 22, 5] have a long and rich history in machine learning [10, 7]

. Recent years have seen an increase in their popularity, owing to their computational efficiency and applicability to large-scale classification and regression tasks. A case in point is Microsoft Kinect where decision trees are trained on millions of exemplars to enable real-time human pose estimation from depth images 

[23].

Conventional algorithms for decision tree induction are greedy. They grow a tree one node at a time following procedures laid out decades ago by frameworks such as ID3 [22] and CART [6]. While recent work has proposed new objective functions to guide greedy algorithms [21, 12], it continues to be the case that decision tree applications (e.g., [9, 14]) utilize the same dated methods of tree induction. Greedy decision tree induction builds a binary tree via a recursive procedure as follows: beginning with a single node, indexed by , a split function is optimized based on a corresponding subset of the training data such that is split into two subsets, which in turn define the training data for the two children of the node . The intrinsic limitation of this procedure is that the optimization of is solely conditioned on , i.e., there is no ability to fine-tune the split function based on the results of training at lower levels of the tree. This paper addresses this limitation by proposing a general framework for non-greedy learning of the split parameters for tree-based methods. We focus on binary trees, while extension to -ary trees is possible. We show that our joint optimization of the split functions at different levels of the tree under a global objective not only promotes cooperation between the split nodes to create more compact trees, but also leads to better generalization performance.

One of the key contributions of this work is establishing a link between the decision tree optimization problem and the problem of structured prediction with latent variables [26]. We present a novel formulation of the decision tree learning that associates a binary latent decision variable with each split node in the tree and uses such latent variables to formulate the tree’s empirical loss. Inspired by advances in structured prediction [24, 25, 26], we propose a convex-concave upper bound on the empirical loss. This bound acts as a surrogate objective that is optimized using stochastic gradient descent (SGD) to find a locally optimal configuration of the split functions. One complication introduced by this particular formulation is that the number of latent decision variables grows exponentially with the tree depth . As a consequence, each gradient update will have a complexity of for -dimensional inputs. One of our technical contributions is showing how this complexity can be reduced to by modifying the surrogate objective, thereby enabling efficient training of deep trees.

2 Related work

Finding optimal split functions at different levels of a decision tree according to some global objective, such as a regularized empirical risk, is NP-complete [11] due to the discrete and sequential nature of the decisions in a tree. Thus, finding an efficient alternative to the greedy approach has remained a difficult objective despite many prior attempts.

Bennett [2]

proposes a non-greedy multi-linear programming based approach for global tree optimization and shows that the method produces trees that have higher classification accuracy than standard greedy trees. However, their method is limited to binary classification with

- loss and has a high computation complexity, making it only applicable to trees with few nodes.

The work in [15] proposes a means for training decision forests in an online setting by incrementally extending the trees as new data points are added. As opposed to a naive incremental growing of the trees, this work models the decision trees with Mondrian Processes.

The Hierarchical Mixture of Experts model [13]

uses soft splits rather than hard binary decisions to capture situations where the transition from low to high response is gradual. The use of soft splits at internal nodes of the tree yields a probabilistic model in which the log-likelihood is a smooth function of the unknown parameters. Hence, training based on log-likelihood is amenable to numerical optimization via methods such as expectation maximization (EM). That said, the soft splits necessitate the evaluation of all or most of the experts for each data point, so much of the computational advantage of the decision trees are lost.

Murthy and Salzburg [17] argue that non-greedy tree learning methods that work by looking ahead are unnecessary and sometimes harmful. This is understandable since their methods work by minimizing empirical loss without any regularization, which is prone to overfitting. To avoid this problem, it is a common practice (see Breiman [5] or Criminisi and Shotton [7] for an overview) to limit the tree depth and introduce limits on the number of training instances below which a tree branch is not extended, or to force a diverse ensemble of trees (i.e., a decision forest) through the use of bagging [5] or boosting [8]. Bennett and Blue [3]

describe a different way to overcome overfitting by using max-margin framework and the Support Vector Machines (SVM) at the split nodes of the tree. Subsequently, Bennett

et al. [4]

show how enlarging the margin of decision tree classifiers results in better generalization performance.

Our formulation for decision tree induction improves on prior art in a number of ways. Not only does our latent variable formulation of decision trees enable efficient learning, but it also handles any general loss function while not sacrificing the

complexity of inference imparted by the tree structure. Further, our surrogate objective provides a natural way to regularize the joint optimization of tree parameters to discourage overfitting.

3 Problem formulation

For ease of exposition, this paper focuses on binary classification trees, with internal (split) nodes, and leaf (terminal) nodes. Note that in a binary tree the number of leaves is always one more than the number of internal (non-leaf) nodes. An input, , is directed from the root of the tree down through internal nodes to a leaf node. Each leaf node specifies a distribution over class labels. Each internal node, indexed by , performs a binary test by evaluating a node-specific split function . If evaluates to , then is directed to the left child of node . Otherwise, is directed to the right child. And so on down the tree. Each split function , parameterized by a weight vector , is assumed to be a linear threshold function, i.e., . We incorporate an offset parameter to obtain split functions of the form by appending a constant “” to the input feature vector.

Each leaf node, indexed by

, specifies a conditional probability distribution over class labels,

, denoted . Leaf distributions are parametrized with a vector of unnormalized predictive log-probabilities, denoted , and a softmax function; i.e.,

(1)

where denotes the element of vector .

The parameters of the tree comprise the internal weight vectors, , and the vectors of unnormalized log-probabilities, one for each leaf node, . We pack these parameters into two matrices and whose rows comprise weight vectors and leaf parameters, i.e.,  and . Given a dataset of input-output pairs, , where is the ground truth class label associated with input , we wish to find a joint configuration of oblique splits and leaf parameters that minimize some measure of misclassification loss on the training dataset. Joint optimization of the split functions and leaf parameters according to a global objective is known to be extremely challenging [11] due to the discrete and sequential nature of the splitting decisions within the tree.

One can evaluate all of the split functions, for every internal node of the tree, on an input by computing , where is the element-wise sign function. One key idea that helps linking decision tree learning to latent structured prediction is to think of an -bit vector of potential split decisions, e.g., , as a latent variable. Such a latent variable determines the leaf to which a data point is directed, and then classified using the leaf parameters. To formulate the loss for an input-output pair, , we introduce a tree navigation function that maps an -bit sequence of split decisions () to an indicator vector that specifies a -of- encoding. Such an indicator vector is only non-zero at the index of the selected leaf. Fig. 1 illustrates the tree navigation function for a tree with internal nodes.

+1

-1

+1

-1

+1

+1

Figure 1: The binary split decisions in a decision tree with internal nodes can be thought as a binary vector . Tree navigation to reach a leaf can be expressed in terms of a function . The selected leaf parameters can be expressed by .

Using the notation developed above, represents the parameters corresponding to the leaf to which is directed by the split functions in . A generic loss function of the form measures the discrepancy between the model prediction based on and an output . For the softmax model given by (1), a natural loss is the negative log probability of the correct label, referred to as log loss,

(2)

For regression tasks, when , and the value of is directly emitted as the model prediction, a natural choice of is squared loss,

(3)

One can adopt other forms of loss within our decision tree learning framework as well. The goal of learning is to find and that minimize empirical loss, for a given training set , that is,

(4)

Direct global optimization of empirical loss with respect to is challenging. It is a discontinuous and piecewise-constant function of . Furthermore, given an input , the navigation function yields a leaf parameter vector based on a sequence of binary tests, where the results of the initial tests determine which subsequent tests are performed. It is not clear how this dependence of binary tests should be formulated.

4 Decision trees and structured prediction

To overcome the intractability in the optimization of , we develop a piecewise smooth upper bound on empirical loss. Our upper bound is inspired by the formulation of structured prediction with latent variables [26]. A key observation that links decision tree learning to structured prediction, is that one can re-express in terms of a latent variable . That is,

(5)

In this form, decision tree’s split functions implicitly map an input to a binary vector by maximizing a score function , the inner product of and . One can re-express the score function in terms of a more familiar form of a joint feature space on and , as , where , and . Previously, Norouzi et al. [19, 20] used the same re-formulation (5) of linear threshold functions to learn binary similarity preserving hash functions.

Given (5), we re-express empirical loss as,

(6)

This objective resembles the objective functions used in structured prediction, and since we do not have a priori access to the ground truth split decisions, , this problem is a form of structured prediction with latent variables.

5 Upper bound on empirical loss

We develop an upper bound on loss for an input-output pair, , which takes the form,

(7)

To validate the bound, first note that the second term on the RHS is maximized by . Second, when , it is clear that the LHS equals the RHS. For all other values of , the RHS can only get larger than when because of the max operator. Hence, the inequality holds. An algebraic proof of (7) is presented in the Appendix.

In the context of structured prediction, the first term of the upper bound, i.e., the maximization over , is called loss-augmented inference, as it augments the standard inference problem, i.e., the maximization over , with a loss term. Fortunately, the loss-augmented inference for our decision tree learning formulation can be solved exactly, as discussed below.

It is also notable that the loss term on the LHS of (7) is invariant to the scale of , but the upper bound on the right side of (7) is not. As a consequence, as with binary SVM and margin-rescaling formulations of structural SVM [25], we introduce a regularizer on the norm of when optimizing the bound. To justify the regularizer, we discuss the effect of the scale of on the bound.

Proposition 1.

The upper bound on the loss becomes tighter as a constant multiple of increases, i.e., for :

(8)
Proof.

Please refer to the Appendix for the proof. ∎

In the limit, as the scale of approach , the loss term becomes negligible compared to the score term . Thus, the solutions to loss-augmented inference and inference become almost identical, except when an element of is very close to . Thus, even though a larger yields a tighter bound, it makes the bound approach the loss itself, and therefore becomes nearly piecewise-constant, which is hard to optimize. In fact, based on Proposition 1, one easy way to decrease the upper bound is to increase the norm of , which does not affect the loss.

Our experiments indicate that when the norm of is regularized, a lower value of the loss at both training and validation time can be achieved. We therefore constrain the norm of to obtain an objective with better behavior and generalization. Since each row of acts independently in a decision tree in the split functions, it is reasonable to constrain the norm of each row independently. Summing over the bounds for different training pairs and constraining the norm of rows of , we obtain the following optimization problem, called the surrogate objective:

(9)

where is a regularization parameter and is the row of . For all values of , we have . Instead of using the typical Lagrange form for regularization, we employ hard constraints to enable sparse gradient updates of the rows of , since as explained below, the gradients for most rows of are zero at each step of training.

6 Optimizing the surrogate objective

Even though minimizing the surrogate objective of (9) entails non-convex optimization, is much better behaved than empirical loss in (4). is piecewise linear and convex-concave in , and the constraints on define a convex set.

Loss-augmented inference. To evaluate and use the surrogate objective in (9) for optimization, we must solve a loss-augmented inference problem to find the binary code that maximizes the sum of the score and loss terms:

(10)

An observation that makes this optimization tractable is that can only take on distinct values, which correspond to terminating at one of the leaves of the tree and selecting a leaf parameter from . Fortunately, for any leaf index , we can solve

(11)

efficiently. Note that if , then equals the row of , i.e., . To solve (11) we need to set all of the binary bits in corresponding to the path from the root to the leaf to be consistent with the path direction toward the leaf . However, bits of that do not appear on this path have no effect on the output of , and all such bits should be set based on to obtain maximum . Accordingly, we can essentially ignore the off-the-path bits by subtracting from (11) to obtain,

(12)

Note that is constant in , and this subtraction zeros out all bits in that are not on the path to the leaf . So, to solve (12), we only need to consider the bits on the path to the leaf for which is not consistent with the path direction. Using a single depth-first search on the decision tree, we can solve (11) for every , and among those, we pick the one that maximizes (11).

The algorithm described above is , where is the tree depth, and we require a multiple of for computing the inner product at each internal node . This algorithm is not efficient for deep trees, especially as we need to perform loss-augmented inference once for every stochastic gradient computation. In what follows, we develop an alternative more efficient formulation and algorithm with time complexity of .

Fast loss-augmented inference. To develop a faster loss-augmented inference algorithm, we formulate a slightly different upper bound on the loss, i.e.,

(13)

where denotes the Hamming ball of radius around , i.e., , hence implies that and differ in at most one bit. The proof of (13) is identical to the proof of (7). The key benefit of this new formulation is that loss-augmented inference with the new bound is computationally efficient. Since and differ in at most one bit, then can only take distinct values. Thus we need to evaluate (12) for at most values of , requiring a running time of .

Stochastic gradient descent (SGD). A reasonable approach to minimizing (9) uses stochastic gradient descent (SGD), the steps of which are outlined in Alg 1. Here, denotes the learning rate, and is the number of optimization steps. Line corresponds to a gradient update in , which is supported by the fact that . Line performs projection back to the feasible region of , and Line updates based on the gradient of the loss. Our implementation modifies Alg 1 by adopting common SGD tricks, including the use of momentum and mini-batches.

1:  Initialize and using greedy procedure 2:  for  to  do 3:     Sample a pair uniformly at random from 4:      5:      6:      7:     for  to  do 8:         9:     end for 10:      11:  end for
Algorithm 1 Stochastic gradient descent (SGD) algorithm for non-greedy decision tree learning.

Stable SGD (SSGD). Even though Alg 1 achieves good training and test accuracy relatively quickly, we observe that after several gradient updates some of the leaves may end up not being assigned to any data points and hence the full tree capacity may not be exploited. We call such leaves inactive as opposed to active leaves that are assigned to at least one training data point. An inactive leaf may become active again, but this rarely happens given the form of gradient updates. To discourage abrupt changes in the number of inactive leaves, we introduce a variant of SGD, in which the assignments of data points to leaves are fixed for a number of gradient update steps. Thus, the bound is optimized with respect to a set of data point to leaf assignment constraints. When the improvement in the bound becomes negligible the leaf assignment variables are updated, followed by another round of optimization of the bound. We call this algorithm Stable SGD (SSGD) because it changes the assignment of data points to leaves more conservatively than SGD. Let denote the -of- encoding of the leaf to which a data point should be assigned to. Then, SSGD with fast loss-augmented inference relies on the following upper bound on loss,

(14)

One can easily verify that the RHS of (14) is larger than the RHS of (13), hence the inequality.

Computational complexity. To analyze the computational complexity of each SGD and SSGD step, we note that Hamming distance between (defined in (10)) and is bounded above by the depth of the tree . This is because only those elements of corresponding to the path to a selected leaf can differ from . Thus, for SGD the expression needed for Line 6 of Alg 1 can be computed in , if we know which bits of and differ. Accordingly, Lines 6 and 7 can be performed in . The computational bottleneck is the loss augmented inference in Line 5. When fast loss-augmented inference is performed in time, the total time complexity of gradient update for both SGD and SSGD becomes , where is the number of labels.

7 Experiments

Experiments are conducted on several benchmark datasets from LibSVM [1] for multi-class classification, namely SensIT, Connect4, Protein, and MNIST. We use the provided train, validation, test sets when available. If such splits are not provided, we use a random split of the training data for train and validation sets and a random split for train, validation, test sets.

   SensIT Connect4 Protein MNIST
Figure 2: Test and training accuracy of a single tree as a function of tree depth for different methods. Non-greedy trees achieve better test accuracy throughout different depths. Non-greedy exhibit less vulnerability to overfitting.

We compare our method for non-greedy learning of oblique trees with several greedy baselines, including conventional axis-aligned trees based on information gain, OC1 oblique trees [17] that use coordinate descent for optimization of the splits, and random

oblique trees that select the best split function from a set of randomly generated hyperplanes based on information gain. We also compare with the results of

CO2 [18], which is a special case of our upper bound approach applied greedily to trees of depth , one node at a time. Any base algorithm for learning decision trees can be augmented by post-training pruning [16], or building ensembles with bagging [5] or boosting [8]. However, the key differences between non-greedy trees and baseline greedy trees become most apparent when analyzing individual trees. For a single tree the major determinant of accuracy is the size of the tree, which we control by changing the maximum tree depth.

Fig. 2 depicts test and training accuracy for non-greedy trees and four other baselines as function of tree depth. We evaluate trees of depth up to at depth intervals of . The hyper-parameters for each method are tuned for each depth independently. While the absolute accuracy of our non-greedy trees varies between datasets, a few key observations hold for all cases. First, we observe that non-greedy trees achieve the best test performance across tree depths across multiple datasets. Second, trees trained using our non-greedy approach seem to be less susceptible to overfitting and achieve better generalization performance at various tree depths. As described below, we think that the norm regularization provides a principled way to tune the tightness of the tree’s fit to the training data. Finally, the comparison between non-greedy and CO2 [18] trees concentrates on the non-greediness of the algorithm, as it compares our method with its simpler variant, which is applied greedily one node at a time. We find that in most cases, the non-greedy optimization helps by improving upon the results of CO2.

Regularization parameter ()

Num. active leaves
Tree depth =10

Regularization parameter ()
Tree depth =13

Regularization parameter ()
Tree depth =16
Figure 3: The effect of on the structure of the trees trained by MNIST. A small value of prunes the tree to use far fewer leaves than an axis-aligned baseline used for initialization (dotted line).
Figure 4: Total time to execute epochs of SGD on the Connect4 dataset using loss-agumented inference and its fast varient.

A key hyper-parameter of our method is the regularization constant in (9), which controls the tightness of the upper bound. With a small , the norm constraints force the method to choose a with a large margin at each internal node. The choice of is therefore closely related to the generalization of the learned trees. As shown in Fig. 3, also implicitly controls the degree of pruning of the leaves of the tree during training. We train multiple trees for different values of , and we pick the value of that produces the tree with minimum validation error. We also tune the choice of the SGD learning rate, , in this step. Such and are used to build a tree using the union of both the training and validation sets, which is evaluated on the test set.

To build non-greedy trees, we initially build an axis-aligned tree with split functions that threshold a single feature, optimized using conventional procedures that maximize information gain. The axis-aligned split is used to initialize a greedy variant of the tree training procedure, called CO2 [18]. This provides initial values for and for the non-greedy procedure.

Fig. 4 shows an empirical comparison of training time for SGD with loss-augmented inference and fast loss-augmented inference. As expected, run-time of SGD with loss-augmented inference exhibits exponential growth with deep trees whereas its fast variant is much more scalable. We expect to see better speedup factors for larger datasets. Connect4 only has training points.

8 Conclusion

We present a non-greedy method for learning decision trees using stochastic gradient descent to optimize an upper bound on the tree’s empirical loss on a training dataset. Our model poses the global training of decision trees in a well-characterized optimization framework. This makes it simpler to pose extensions that could be considered in future work. Efficiency gains could be achieved by learning sparse split functions via sparsity-inducing regularization on . Further, the core optimization problem permits applying the kernel trick to the linear split parameters , making our overall model applicable to learning higher-order split functions or training decision trees on examples in arbitrary reproducing kernel Hilbert spaces.

Acknowledgment. MN was financially supported in part by a Google fellowship. DF was financially supported in part by NSERC Canada and the NCAP program of the CIFAR.

References

  • [1] http://www.csie.ntu.edu.tw/c̃jlin/libsvmtools/datasets/.
  • [2] K. P. Bennett. Global tree optimization: A non-greedy decision tree algorithm. Computing Science and Statistics, pages 156–156, 1994.
  • [3] K. P. Bennett and J.A. Blue. A support vector machine approach to decision trees. In Department of Mathematical Sciences Math Report No. 97-100, Rensselaer Polytechnic Institute, pages 2396–2401, 1997.
  • [4] K. P. Bennett, N. Cristianini, J. Shawe-Taylor, and D. Wu.

    Enlarging the margins in perceptron decision trees.

    Machine Learning, 41(3):295–313, 2000.
  • [5] L. Breiman. Random forests. Machine Learning, 45(1):5–32, 2001.
  • [6] L. Breiman, J. Friedman, R. A. Olshen, and C. J. Stone. Classification and regression trees. Chapman & Hall/CRC, 1984.
  • [7] A. Criminisi and J. Shotton. Decision Forests for Computer Vision and Medical Image Analysis. Springer, 2013.
  • [8] Jerome H Friedman.

    Greedy function approximation: a gradient boosting machine.

    Annals of Statistics, pages 1189–1232, 2001.
  • [9] J. Gall, A. Yao, N. Razavi, L. Van Gool, and V. Lempitsky. Hough forests for object detection, tracking, and action recognition. IEEE Trans. PAMI, 33(11):2188–2202, 2011.
  • [10] T. Hastie, R. Tibshirani, and J. Friedman. The elements of statistical learning (Ed. 2). Springer, 2009.
  • [11] L. Hyafil and R. L. Rivest. Constructing optimal binary decision trees is NP-complete. Information Processing Letters, 5(1):15–17, 1976.
  • [12] J. Jancsary, S. Nowozin, and C. Rother. Loss-specific training of non-parametric image restoration models: A new state of the art. ECCV, 2012.
  • [13] M. I. Jordan and R. A. Jacobs. Hierarchical mixtures of experts and the em algorithm. Neural Comput., 6(2):181–214, 1994.
  • [14] E. Konukoglu, B. Glocker, D. Zikic, and A. Criminisi. Neighbourhood approximation forests. In Medical Image Computing and Computer-Assisted Intervention–MICCAI 2012, pages 75–82. Springer, 2012.
  • [15] B. Lakshminarayanan, D. M. Roy, and Y. H. Teh. Mondrian forests: Efficient online random forests. In Advances in Neural Information Processing Systems, pages 3140–3148, 2014.
  • [16] J. Mingers. An empirical comparison of pruning methods for decision tree induction. Machine Learning, 4(2):227–243, 1989.
  • [17] S. K. Murthy and S. L. Salzberg. On growing better decision trees from data. PhD thesis, John Hopkins University, 1995.
  • [18] M. Norouzi, M. D. Collins, D. J. Fleet, and P. Kohli. Co2 forest: Improved random forest by continuous optimization of oblique splits. arXiv:1506.06155, 2015.
  • [19] M. Norouzi and D. J. Fleet. Minimal Loss Hashing for Compact Binary Codes. ICML, 2011.
  • [20] M. Norouzi, D. J. Fleet, and R. Salakhutdinov. Hamming Distance Metric Learning. NIPS, 2012.
  • [21] S. Nowozin. Improved information gain estimates for decision tree induction. ICML, 2012.
  • [22] J. R. Quinlan. Induction of decision trees. Machine learning, 1(1):81–106, 1986.
  • [23] J. Shotton, R. Girshick, A. Fitzgibbon, T. Sharp, M. Cook, M. Finocchio, R. Moore, P. Kohli, A. Criminisi, A. Kipman, et al. Efficient human pose estimation from single depth images. IEEE Trans. PAMI, 2013.
  • [24] B. Taskar, C. Guestrin, and D. Koller. Max-margin Markov networks. NIPS, 2003.
  • [25] I. Tsochantaridis, T. Hofmann, T. Joachims, and Y. Altun. Support vector machine learning for interdependent and structured output spaces. ICML, 2004.
  • [26] C. N. J. Yu and T. Joachims. Learning structural SVMs with latent variables. ICML, 2009.

Appendix A Proofs

Upper bound on loss. For any pair , the loss is upper bounded by:

(15)
Proof.
RHS
LHS

Proposition 2.

The upper bound on the loss becomes tighter as a constant multiple of gets larger. More formally, for any , we have:

(16)
Proof.

Let

then we have:

(17)

We also have:

(18)

Moreover,

(19)

Now, summing the two sides of (17) and (19), and using (18), the inequality is proved. ∎