One-Stage Tree: end-to-end tree builder and pruner

Decision trees have favorable properties, including interpretability, high computational efficiency, and the ability to learn from little training data. Learning a decision tree is known to be NP-complete. The researchers have proposed many greedy algorithms such as CART to learn approximate solutions. Inspired by the current popular neural networks, soft trees that support end-to-end training with back-propagation have attracted more and more attention. However, existing soft trees either lose the interpretability due to the continuous relaxation or employ the two-stage method of end-to-end building and then pruning. In this paper, we propose One-Stage Tree to build and prune the decision tree jointly through a bilevel optimization problem. Moreover, we leverage the reparameterization trick and proximal iterations to keep the tree discrete during end-to-end training. As a result, One-Stage Tree reduces the performance gap between training and testing and maintains the advantage of interpretability. Extensive experiments demonstrate that the proposed One-Stage Tree outperforms CART and the existing soft trees on classification and regression tasks.


Introduction
Compared with currently popular neural networks, decision trees have several favorable properties, such as good interpretability and high computational efficiency.In many practical ML (Machine Learning) applications (Chen & Guestrin, 2016;Ke et al., 2017;Wu et al., 2020;Li et al., 2020), the decision tree has proven its worth and achieved great success.
A decision tree is a hierarchical structure for the supervised learning task, composed of internal nodes and leaf nodes.The parameters of a decision tree can be divided into three parts: (1) internal parameters , which decide the direction of each instance x by the router function s; (2) leaf parameters , which are the prediction outputs of all leaves T ; (3) architecture parameters , which define the architecture of the tree.Then, an instance x is recursively directed to the left or right child of the internal node i by the router function s(x; i ) .When a leaf t is reached (i.e., t = 0 ), the leaf parameter t is used as the prediction.Traditionally, splitting rules are used to learn the node (i.e., internal and leaf) parameters ( , ) , and stopping rules are used to learn the architecture parameters .
As shown in Fig. 1, decision trees can be divided into hard trees and soft trees.For the hard tree in Fig. 1a, the response at node i has the following recursive definition: where i ∈ {0, 1} , s ∶ x → {[1, 0] T , [0, 1] T } is an axis-parallel split with a one-hot vector i , and L(i)/R(i) is the left/right child of node i.For example, CART (Breiman et al., 1984) greedily chooses the split feature and threshold by minimizing the Gini Index in the current node.Furthermore, top-down pre-pruning and minimal cost-complexity post-pruning (Breiman et al., 1984) are used as the stopping rules to improve the tree's generalization.
The greedy-based splitting and stopping rules in hard trees inevitably have the disadvantage of building sub-optimal decision trees.Moreover, despite the low empirical error, decision trees are easily overfitted (Kotsiantis, 2013).To improve learning through end-to-end training with back-propagation, soft trees (Norouzi et al., 2015;Irsoy et al., 2014;Hehn et al., 2019) are proposed.
As shown in Fig. 1b, the soft tree relaxes the parameters to be continuous, e.g., the discrete choices of (i.e., whether to prune) and s (i.e., which path to route).Thus, the response at node i can be expressed as follows: (1) Fig. 1 Overview of a hard tree (a) and a soft tree (b). a The dashed lines indicate the pruned nodes (i.e., i = 0 ).The path where the instance x is routed is shown in purple.As two parts of the internal parameters i , w i and b i indicate the feature weight and the feature threshold respectively.b For the soft tree, the color transparency indicates the path probability where i ∈ [0, 1] , and s ∶ x → [0, 1] 2 is an oblique split with i ∈ ℝ d .Due to the continuous characteristics, various techniques (e.g., Gradient Descent (Bottou, 2012;Mukkamala & Hein, 2017) and Regularization (Prechelt, 1998;Bousquet et al., 2004)) in deep learning can be used for end-to-end tree training.
However, designing effective soft trees is a challenging task.Soft Decision Tree (Irsoy et al., 2012;Norouzi et al., 2015) only considers the global optimization of node parameters ( , ) , omitting the architecture parameters .Breiman et al. (1984) pointed out that tree quality depends more on good stopping rules than on splitting rules.That is, is more crucial in some way.Budding Tree (Irsoy et al., 2014) considers the architecture parameters, but its randomly pruned nodes fail to bud.All of the above methods directly utilize probabilistic trees when testing, which looses the interpretability of decision trees.End2End Tree (Hehn et al., 2019) maintains a probabilistic tree for training and discretizes it to a deterministic one for testing.However, there exists a performance gap after the discretization.Moreover, End2End Tree is a two-stage method that first learns the node parameters end-to-end and then searches by the greedy algorithm.
In this work, we propose One-Stage Tree, which is, to our best knowledge, the first soft tree that maintains discretization during training.In contrast to the two-stage methods (e.g., CART and End2End Tree) of building and then pruning, we first formalize the joint search for node and architecture parameters as a bilevel optimization problem.Then, we keep the discretization of the path and architecture during training.Specifically, we directly sample leaves by the Gumbel Softmax to predict instances according to the path probability and propose an optimization strategy for discrete via proximal iterations.Benefiting from the discretization, we directly find the closed-form optimal solution of .Moreover, we reduce the performance gap and maintain interpretability.
Extensive experimental results on both classification and regression tasks reveal the effectiveness of One-Stage Tree.One-Stage Tree has a significant improvement over the most typical CART.Compared with the existing soft trees, One-Stage Tree achieves better performance on most datasets.Moreover, One-Stage Tree is competitive with other standard ML methods.The implementation of One-Stage Tree is publicly available on GitHub. 1o summarize, our main contributions can be highlighted as follows: • We introduce One-Stage Tree to search the node and architecture parameters jointly through a bilevel optimization problem.The rest of the paper is structured as follows: after introducing related work in soft trees (Sect.2), we describe our approach in detail (Sect.3).We then report experimental results on classification and regression datasets (Sect.4) before concluding the paper (Sect.5). (2) 2 Related work

Soft tree
The decision tree is among the most popular machine learning algorithms, given its interpretability and simplicity.First, due to the axis-parallel split of each internal node, the decision tree can learn from little training data and is easy to interpret.Then, benefiting from the hierarchical architecture, the decision tree is computationally efficient, with only O(log |I|) nodes needing to be visited out of all |I| internal nodes for a binary complete tree.
The decision tree structure depends on internal parameters and router function s(x; i ) .The most typical one is the univariate discrete tree (Quinlan, 1986(Quinlan, , 1996;;Breiman et al., 1984), also called hard tree, where ‖ i ‖ 0 = 1 and ‖s(x; i )‖ 0 = 1 .Hard Tree selects a subpath for instances according to a specific feature and threshold.In the multivariate tree (Irsoy et al., 2012;Norouzi et al., 2015;Irsoy et al., 2014;Hehn et al., 2019), which is also called soft tree, i is a continuous variable and s(x; i ) defines an oblique split.
Soft Decision Tree (Irsoy et al., 2012) takes the sigmoid function as the router function and builds a multivariate dense tree whose prediction is contributed by leaves with different probabilities.For Soft Decision Tree, s(x , routes instances to all its children with probabilities.Although it has a smoother fit and lower bias around the split boundaries, all the leaves' paths are traversed.The computational overhead increases from O(log(|I|)) to O(|I|) , where I denotes the set of internal nodes.
Unlike Soft Decision Tree that only searches the splitting rule, Budding Tree (Irsoy et al., 2014) relaxes and fits the tree architecture.The bud node i can be an internal node and a leaf at the same time according to i .By gradient descent, Budding Tree splits and prunes the tree in the learning phase.However, i will never be updated once it equals 0, which is called dying problem.
Being aware of the benefits of discretization in terms of interpretability, End2End Tree (Hehn et al., 2019) proposes a multivariate discrete tree.End2End Tree is fully probabilistic at train time but becomes deterministic at test time after an annealing process.The performance gap between training and testing still exists.Moreover, the tree architecture is still searched greedily, with the risk of a sub-optimal architecture.
In this paper, we propose One-Stage Tree to build and prune the tree jointly.One-Stage Tree directly samples the leaf node as prediction and keeps the discretization of the architecture during training.We leverage the reparameterization trick and proximal iterations to optimize the multivariate discrete tree.

Proximal algorithm
PA (Proximal Algorithm) (Parikh & Boyd, 2014) is a popular optimization technique for handling the following problem: where f and g are closed proper convex, f is differentiable, and C is the feasible space.The crux of PA is the standard proximal step: (3) prox C, g (⋅) represents the standard proximal operator of g with scale parameter con- strained by C (Parikh & Boyd, 2014).In this form, we split the objective into two terms, one of which is differentiable.Since g can be extended-valued, it can be used to encode constraints on x.
In machine learning, PA is widely used to solve the continuously differentiable optimization problem with a constraint C as min x f (x) where x ∈ C .Since g(x) = 0 , the proximal step is simplified to x (k+1) = prox C (x (k) − ∇f (x (k) )) .Due to its excellent theoretical guarantee and good empirical performance, it has been applied to many deep learning problems (e.g., network binarization (Bai et al., 2018) and recommendation system (Yao et al., 2020)).Another variant of PA with lazy proximal step (Xiao, 2010) maintains two copies of x, i.e., Although it has no convergence guarantee in the non-convex case, it performs well empirically on deep learning tasks (Courbariaux et al., 2015;Hou et al., 2017).

Methodology
In this section, we introduce One-Stage Tree, which is trained with the reparameterization trick and proximal iterations in an end-to-end manner.

Problem formulation
Consider a supervised task with input space X ⊂ ℝ d and output space Y ⊂ ℝ c .Let D be the data distribution.We denote the training set sampled from D as D train .The training set is also defined as {x 1 , … , x N } ⊂ X with corresponding {y 1 , … , y N } ⊂ Y .Let l be a differenti- able convex function that measures the difference between the prediction and the target.We denote the overall loss on a given dataset as L( ).
The soft tree relaxes the parameters to be continuous, recursively calculates the probability s(x; i ) from an internal node i to its children, and finally gets the path probability t (x; , ) from the root to each leaf t.Let Path(t) be the node set from the root to leaf t.The path probability t (x; , ) is calculated as follows: where represents the 0-1 indicator function and L(i) denotes the left child of node i.If L(i) ∈ Path(t) is satisfied, the indicator function equals 1.For example, s(x; i ) 0 indicates the probability of routing the left child.The response of the soft tree is the probabilityweighted sum of the leaf values.
After the continuous relaxation, the goal is to jointly learn the tree parameters and find the global optima, which can be optimized by gradient descent: (4) where  > 0 and prox C,g (x) = arg min

One-Stage Tree
Although the continuous relaxation allows the whole tree to be differentiable, soft trees have significant limitations: 1. Interpretability Although the oblique split i indicates feature importance, path probabilities at large depths are difficult to interpret.2. Performance The continuous architecture needs to be discretized to {0, 1} at test time, resulting in inconsistent performance between training and testing.
Recall that in hard trees, the trees are all discrete when updating node parameters.Such discretization naturally alleviates the above limitations.Thus, we aim to search the differentiable soft tree but keep discrete architectures and paths when updating the parameters.Like decision trees that use the validation set for pruning, we divide the training set into two parts (i.e., the training set and validation set) and minimize the following objective: where L train and L val are the losses on the training and validation sets, respectively.We call it One-Stage Tree because it keeps the discretization while simultaneously completing the two stages of building and pruning.The one-stage optimization is achieved by solving the bilevel optimization problem in Eq. ( 9).However, the problem of discretization remains.Specifically, the discretization in One-Stage Tree can be divided into two parts: • Discretization of Probabilistic Path A discrete path routes an instance from root to a leaf.In soft trees, the paths are probabilistic and summed as prediction ∑ t∈T t (x; , ) ⋅ t .To discretize the path, a straightforward idea is to sample a path as the prediction based on the probability.The Monte Carlo method (Metropolis and Ulam, 1949) can be used to estimate the expectation of the loss.We use the reparameterization trick (Blum et al., 2015) to make it differentiable w.r.t .To approximate the sampling estimator to the true expectation, we use the Gumbel Softmax (Maddison et al., 2014) for reparameterization.
• Discretization of Continuous Architecture The continuous relaxation of unifies the forms of node and leaf.However, it makes the tree architecture difficult to interpret and leads to low computational efficiency caused by that all nodes need to be visited.
To summarize, as shown in Fig. 2, One-Stage Tree retains the advantages of hard trees as discrete inference models and improves learning through end-to-end training with back-propagation.

Gumbel-softmax path
The probabilistic path from the root to the leaf t lacks interpretability and leads to iterative optimization of the leaf parameters .To discretize the probabilistic path, we express the router at node i as a random variable s(x; i ) ∼ q i (s|x) .Thus, a discrete path is sampled from a continuous distribution parameterized by .In this way, we can explore the diversity, where each instance can belong to different leaves, and exploit the best path with the highest probability.Traditionally, each instance belongs to a fixed leaf by the splitting rule, and each leaf calculates by its instances (e.g., the average of labels in CART).Here, by sampling from the random variable when training, we explore the case that each instance can be held by different leaves in the optimization process.Moreover, we directly choose the path with the highest probability as exploitation when testing.
However, as a result of sampling, the loss cannot be propagated backward to .To train , we reparameterize the random variable s using a differentiable transformation g i ( , x) , where g is parameterized by i and is an (auxiliary) noise variable with independent marginal p( ).
Using the reparameterization trick, we can now form MC (Monte Carlo) estimates (Metropolis & Ulam, 1949) of the expectation of the loss, which is differentiable w.r.t., as follows: Fig. 2 Overview of One-Stage Tree.Each node i can be either an internal node (i.e., i is emphasized) or a leaf (i.e., i is emphasized) according to i .The path, where the instance x (including a bias term) is routed to, is shown in purple.Due to the discretization, x is routed to the left or right child at each node by s(x; ) and finally reaches the leaf as the prediction where M is the number of samples and (m) ∼ p( ) .If L(i) ∈ Path(t) is satisfied, the indica- tor function equals 1 and the probability of routing the left child is g i ( , x) 0 .Specifically, we choose to sample noise from Gumbel Distribution (Gumbel, 1954), which can smoothly approximate the expectation (Maddison et al., 2014;Jang et al., 2016).Correspondingly, the Gumbel Softmax of g i ( , x) is expressed as follows: denotes the temperature of the Gumbel Softmax.In practice, the value of can be empirically set to 1.

Architecture search via proximal iterations
Equation ( 9) implies a bilevel optimization problem with as the upper-level variable and as the lower-level variable.We also relax the discrete choice of whether to prune or not (i.e. i ∈ [0, 1] ).As a result, can be optimized w.r.t.its validation set performance by gradient descent.
Budding Tree (Irsoy et al., 2014) propagates the error backwards from the root towards the leaves.f i denotes the response at node i (Eq.( 2)).Define pa(i) as the parent of node i and i = L∕ f i as the responsibility of node i. Deriving L w.r.t.i , we have: The detailed derivation of Eq. ( 13) can be found in "Appendix 1".From Eq. ( 13), we can see that once the internal node is pruned (i.e., i = 0 ), it will never be able to bud again because its gradient is 0, which we call dying .Moreover, it is prohibitive to evaluate the gradient due to the expensive inner optimization arg min , L train ( , , ) .Following the commonly used method (e.g., meta learning (Finn et al., 2017) and NAS (Liu et al., 2018)), we use a one-step gradient approximation to the optimal internal parameter * to improve efficiency.Thus, the gradient of the architecture parameter is as follows: (11) More specifically, the approximate procedure alternatively optimizes the node parameters ( , ) and the architecture parameters .At step k, given the current architecture (k) , we first calculate (k+1) in closed-form (Sect.3.5).Then, we obtain (k+1) by descending ∇ (k) L train ( (k) , (k+1) , (k) ) with the step size as a one-step optimization for w * under (k) .Then, we update the architecture parameters (k) so as to minimize the validation loss.The architecture gradient is given in Eq. ( 14).We omit the step-index k for brevity.* denotes the optimal leaf values and * denotes the internal parameters with a one-step gradient decent.
However, there exist two problems in solving Eq. ( 14).First, the evaluation of the second-order derivative ∇ 2 is expensive due to a large number of parameters.Second, the con- tinuous trick further leads to the performance gap caused by discretizing i ∈ [0, 1] at train- ing to {0, 1} at testing.
To address the two issues, we employ the variant of Proximal Algorithm (Yao et al., 2020) for optimizing efficiently.Equivalently, we transform i to a 2-d one-hot vector that indicates whether to prune or not, i.e., i ∈ { With such a constrained form, we can apply the composition of lazy and standard proximal steps proposed in Yao et al. (2020).
Algorithm 1 shows the overall workflow of One-Stage Tree that searches the architecture parameters via proximal iterations.In the k-th iteration, the architecture and node parameters are updated alternatively.As the lazy proximal step first projects into the discrete feasible space C 1 , we can obtain the discrete architecture γ (k) = prox C 1 ( (k) ) (Line 3).Then, we calculate the optimal leaf value in closed-form (Sect.3.5) and update the ( 14) internal parameters on the training dataset (Sect.3.3) based on γ (k) (Lines 4-5).After forwarding one-step as in Eq. ( 14), we optimize (k) with the gradient derived from γ (k) as continuous variable and then project it into C 2 (Line 6).
In each proximal iteration, we keep the architecture discrete when training, which contributes to reducing the performance gap caused by discretizing architecture from a continuous one.Moreover, we can ignore the second-order derivative of small magnitude ⋅ because will be projected into the discrete feasible space C 1 in the next iteration, i.e., prox (k+1) ) .Thus, the computational efficiency of updating can be significantly improved.

Optimal leaves in closed-form
Unlike multivariate dense trees (Irsoy et al., 2012(Irsoy et al., , 2014) ) where leaf values are iteratively optimized by gradient descent, we can solve for in closed-form due to the discretization of path and architecture.The prediction f (x) is t when t (x) = 1 .Define (x, y) as an instance and I t = {(x, y)|∀(x, y) ∼ D, t (x; , ) = 1} as the instance set of leaf t, the deriva- tive of the loss function can be expressed as: From Eq. ( 16), the optimal leaves are solved in closed-form by simply deriving l w.r.t. the tree prediction.Let L∕ t = 0 , we show the optimal solution for the leaf values under the common MSE and CrossEntropy losses: , c is the number of classes, and the prob- ability sum is 1): ( 16) In summary, the optimal solution for under both MSE and CrossEntropy is:

In-depth discussion
Table 1 shows the characteristic comparison between One-Stage Tree and other tree models from both training and inference perspectives.
In the training phase, One-Stage Tree improves learning in an end-to-end manner.Unlike the existing soft trees, One-Stage Tree can achieve joint optimization for node and architecture parameters.Soft Decision Tree does not support the optimization of the architecture parameters.Due to the lack of any pruning strategy, Soft Decision Tree is easy to fall into overfitting.Budding Tree considers the search of the architecture parameters, but the dying problem may occur.Compared to One-Stage Tree, End2End Tree is a two-stage method that first learns the node parameters end-to-end and then searches the architecture parameters greedily.Moreover, due to the discretization of path and architecture, One-Stage Tree can efficiently solve in closed form.
In the inference phase, One-Stage Tree can keep the same advantage of interpretability as hard trees due to maintaining discretization.Unlike End2End Tree, which transforms from the probabilistic tree to the deterministic one during inference, One-Stage Tree does not require the additional transformation and thus can reduce the performance gap between training and testing.

Experiments
In this section, we conduct extensive experiments on public datasets to answer the following research questions: • RQ1 How effective is the proposed One-Stage Tree? • RQ2 Is One-Stage Tree robust to hyperparameters?• RQ3 How do different components of One-Stage Tree (e.g., Proximal Algorithm) contribute to the performance?• RQ4 How to reflect the interpretability of One-Stage Tree?

Experimental setting
We use a total of 22 public datasets from OpenML,2 UCI repository,3 and Kaggle. 4There are 17 classification (C) datasets and 5 regression (R) datasets that have various numbers of features (5 to 57) and instances (100 to 30000).
Benefiting from soft trees, One-Stage Tree can be trained using tools from deep learning.We choose the Adam optimizer (Kingma & Ba, 2014) to train One-Stage Tree.The number of epochs is up to 200, the batch size is 32, and the learning rate is 0.01.The other hyperparameters of the Adam optimizer are all the same as default settings.EarlyStopping (Prechelt, 1998), which monitors the validation loss, is used to prevent overfitting with patience of 15.Except for Sect.4.3.1, the depths of all tree models are set to 6 for comparison.
We use MSE loss for regression tasks and CrossEntropy loss for classification tasks in all experiments.Moreover, to evaluate the trees, we use r2-score and accuracy for regression tasks and classification tasks respectively.For clarity, we multiply all metrics by 100 in all tables.
Due to the bilevel optimization, One-Stage Tree splits the raw data as 6:2:2 (train:validation:test) and uses the validation set for optimizing the architecture parameters (i.e., tree pruning).For the other methods (i.e., CART, Soft Decision Tree, and End2End Tree), the raw data is divided using a ratio of 8:2 (train:test).These methods do not require a validation set during training.

Effectiveness of One-Stage Tree (RQ1)
In this subsection, we demonstrate the effectiveness of One-Stage Tree.

Comparison with trees
We compare One-Stage Tree on 22 datasets with the state-of-the-art and baseline tree methods, including: 1. CART (Breiman et al., 1984): the most typical univariate discrete tree, which uses MSE for regression and Gini Index for classification as the splitting rules.We choose the widely-used sklearn.treepackage5 to run CART.For the open-source methods including CART, Soft Decision Tree, and End2End Tree, we directly use the default hyperparameters in the open-source codes.To investigate the stability of the training process, we randomly select 5 random seeds and obtain the mean and standard deviation of the trees' performance.Table 2 shows the comparison results between One-Stage Tree and the open-source methods including CART, Soft Decision Tree, and End2End Tree on classification datasets.Since Soft Decision Tree and End2End Tree do not support regression tasks, we only show the comparison results with CART in Table 3.
Moreover, since Budding Tree is not completely open-source, we directly use the available datasets and the experimental results reported in the original paper (Irsoy et al., 2014).To set up the same experimental setting, we separate 1/3 of the dataset as a test set to evaluate the final performance.The comparison results between One-Stage Tree and Budding Tree are shown in Table 4.According to the comparison results, we can observe that: • The comparison results shown in Table 2 indicate that One-Stage Tree outperforms the existing tree methods and achieves the best performance in all but 1 case on classification datasets.• Besides the classification tasks, One-Stage Tree can also support regression tasks.As shown in Table 3, for regression datasets from different sources, One-Stage Tree outperforms CART on 3/5 datasets.

• The comparison results shown in Table 4 demonstrate that One-Stage Tree outperforms
Budding Tree and CART on 5/8 and 6/8 datasets respectively.Although CART and Budding Tree also search the node and architecture parameters in the training phase, One-Stage Tree shows better performance in learning the tree parameters .• For soft trees, end-to-end training based on gradient descent inevitably has a degree of randomness.Table 2 shows that One-Stage Tree has a smaller standard deviation on most datasets, achieving more stable performance compared to the existing soft trees.

Statistical comparison
To further statistically evaluate the difference between the soft trees, we perform the Friedman test (Demšar, 2006), which is a non-parametric equivalent of the repeated-measures ANOVA.It is used to determine whether or not there is a statistically significant difference between the soft tree models.
For the comparison results in Table 2, we first calculate the Friedman statistic.Let r j i be the rank of the j-th of k soft tree models (k = 4, i.e., CART, Soft Decision Tree, End2End Tree, and One-Stage Tree) on the i-th of N classification datasets.The Friedman test compares the average ranks of models, R j = 1 N ∑ i r j i .The null-hypothesis states that all the tree  models are equivalent and so their ranks R j should be equal.We employ the scipy tool 8 to calculate the Friedman statistic.The Friedman statistic is 19.837209 and the corresponding p-value is 0.00018.Since the p-value is less than 0.05, we can reject the null hypothesis that the performance is the same for all four types of soft trees.In other words, we have sufficient evidence to conclude that the trees lead to statistically significant differences in terms of performance.Since the p-value of the Friedman test is statistically significant, we perform the Nemenyi post-hoc test (Nemenyi, 1963) to further determine exactly which trees have different means.Table 5 shows the p-values for each pairwise comparison.We can conclude that One-Stage Tree is significantly different from other trees for a confidence level of = 0.05 .Additionally, according to the Friedman test, there is no significant dif- ference for the three trees compared in Table 4.
For the regression tasks shown in Table 3, we perform Wilcoxon signed-rank test (Demšar, 2006) to compare the two tree models statistically.The statistic is 5.0 and the corresponding p-value is 0.24886.Thus, there is no statistically significant difference between CART and One-Stage Tree in the regression tasks.

Comparison with other standard ML methods
Moreover, we compare One-Stage Tree with other standard ML methods (i.e., XGBoost (Chen & Guestrin, 2016),9 Support Vector Machine,10 and Multi-Layer Perception11 ) for reference.In particular, a linear kernel for SVM is used.We use the open-source  implementation of the above methods and perform grid search to select the best hyperparameters for the learners in each dataset.The hyperparameter search space can be seen in "Appendix 2".Similarly, 5 randomly selected seeds are used to obtain the performance mean and standard deviation.Figures 3 and 4 show the performance comparison on the classification and regression datasets respectively.The mean performance is present in a bar chart with an error line (i.e., the standard deviation).MLP and SVM perform very poor on the dataset BikeShare DC due to the large range of regression values.Thus, we truncate their performance to 0 in Fig. 4.This also reflects the advantage of tree models that each leaf takes the mean value of its samples as the prediction output.
To present the comparison results clearly, we further calculate the average rank of each method in Table 6.Compared to other methods, One-Stage Tree outperforms traditional machine learning methods MLP and SVM.Although XGBoost ensembles 100 trees with a max depth of 6 via GBDT (Friedman, 2001), One-Stage Tree is still competitive on several datasets.We also consider combining One-Stage Tree with ensemble learning methods such as bagging and boosting to further improve the performance in future work.
In summary, our proposed One-Stage Tree is effective for both classification and regression tasks and outperforms CART and the existing soft trees on most datasets.One-Stage Tree also shows good performance in comparison with other standard machine learning methods.

Robustness of One-Stage Tree (RQ2)
In this subsection, we evaluate whether One-Stage Tree is sensitive to the key hyperparameters, i.e., the tree depth and the validation size .We perform experiments on all classification datasets with the same experimental setting as in RQ1.

Tree depth
The size of tree depth ranges from 1 to 9. We run One-Stage Tree 5 times with different random seeds and report the mean number of internal nodes per tree depth.As shown in Table 7, the optimization of the architecture parameters in One-Stage Tree is effective for tree pruning.At a depth of 9, One-Stage Tree can even prune 60% of the internal nodes.Despite the larger depth, trees may be pruned as shallow ones to avoid the risk of overfitting.
With the increase of the tree depth, the search space of the tree structure is growing.Meanwhile, the ability to find effective trees becomes crucial.Figure 5 shows the performance curves of all tree models with respect to the tree depth.From Fig. 5, we can observe that: • Due to the joint optimization of the node and architecture parameters, One-Stage Tree can achieve better performance than other tree models at different depths.Moreover, from a global perspective, the performance of One-Stage Tree increases with the tree depth.When the tree depth is 9, One-Stage Tree can still achieve performance improvement on several datasets (e.g., Ionosphere and Wine Equality White).• As the tree pruning is not supported, Soft Decision Tree can easily fall into overfitting.
Especially at the larger depth, the performance of Soft Decision Tree may decrease dramatically.• End2End Tree can achieve stable performance at different depths.However, as a twostage method of building and then pruning, it does not perform as well as One-Stage Tree.• For the hard tree CART that greedily achieves building and pruning, the performance at a large tree depth may fall into local optimal.For example, at a depth of 9, the performance of CART is even much worse than that at a depth of 1 on datasets such as SpectF and Hepatitis.
In summary, One-Stage Tree not only achieves stable performance at different tree depths but also achieves performance improvement as the tree depth increases.Moreover, considering that the best performance may be achieved at depth {5, 6, 7} , the uncer- tainty in deep learning is worth noting.More regularization techniques need to be added to alleviate such problems in future work.

Validation size
To evaluate the impact of the validation size, we use the same experimental setting as in RQ1 (e.g., depth of 6 and patience of 15).As shown in Table 8, the performance of One-Stage Tree remains stable with respect to the validation size.Moreover, the comparison results in Table 8 demonstrate that the optimal increases as the number of features decreases.The validation size can be seen as a trade-off for the training of the internal and architecture parameters.As grows, more instances are used to train the architecture

Ablation study (RQ3)
In this subsection, we conduct experiments to check whether the discretization of One-Stage Tree influences the performance gap.To validate the effectiveness of proximal iterations, we propose two variants: • Joint Tree which is a variant of One-Stage Tree without proximal iterations.Joint Tree optimizes the node and architecture parameters according to Eq. ( 8).• Gumbel Tree which is another variant of One-Stage Tree that discretizes the architecture by the Gumbel Softmax in the outer minimization of Eq. ( 9).The details of Gumbel Tree can be found in "Appendix 3".
We perform the experiments on all classification and regression datasets used in RQ1 with the same experimental settings.
The performance comparison is presented in Fig. 6 and Table 9.In Fig. 6, the bar chart shows the performance on the test set to indicate the generalization of the trees, and the line chart shows the performance on the training set to represent the fit of the trees.The height difference between points and bars of the same color represents the performance gap of the tree between training and testing.For greater clarity, we count the number of topranked datasets for each tree in Table 9.
Without dividing the validation set to optimize , Joint Tree obtains a better fit on the training set in all datasets.However, One-Stage Tree achieves a significant performance improvement over Joint Tree on the test set.Compared with Joint Tree, One-Stage Tree reduces the fit to the training set and greatly improves the generalization ability on the test set.The performance gap between training and testing is indeed reduced by proximal iterations.
Additionally, from Fig. 6 and Table 9, we can see that One-Stage Tree performs much better than Gumbel Tree. Figure 6 shows that Gumbel Tree has the worst performance on the training set on most datasets, which indicates that Gumbel Tree is not fully trained.The main reason why the underfitting problem occurs in Gumbel Tree is that the Gumbel Softmax prefers to sample different architectures in the early stage of training.Since the internal parameters and the architecture parameters are optimized alternatively in Eq. ( 9), sampling a significantly different architecture each time plays a negative impact on the one-step approximation of the optimal internal parameters * .In contrast, One-Stage Tree gradually optimizes the current architecture with a small difference to ensure the effectiveness.
Furthermore, as discussed in Sect.4.2.2, we perform the Friedman test (Demšar, 2006) to compare One-Stage Tree with the two variants statistically.The Friedman statistic is 14.2121 and the corresponding p-value is 0.00082.Since the p-value is less than 0.05, we conclude that the trees lead to statistically significant differences.Next, according to the Nemenyi post-hoc test, we further conclude that One-Stage Tree is significantly different from other two variants for a confidence level of = 0.05.

Discussion of interpretability (RQ4)
The interpretability of hard trees helps to understand the mechanism of the tree model and explore the patterns of the dataset.In contrast to hard trees, One-Stage Tree cannot be transformed into several 'if-else' rules based on features and thresholds.In One-Stage Tree, different instances may be routed based on different features at the same node.Thus, unlike hard trees, it is difficult to visualize One-Stage Tree.In Table 10, we summarize the factors for the interpretability of decision trees.Taking a tree of depth 6 trained on the dataset PimaIndian as an example, we discuss the interpretability of One-Stage Tree.

Routing rule
Hard trees use a greedy algorithm to select a split feature at each node with a threshold.It can be seen that a hard tree learns rules from the dataset to route instances to different leaves for prediction.Such 'if-else'-based routing rules are dataset-wise, i.e., each node routes different instances based on the same feature in the inference phase.Thus, they are easy to be understood.
In One-Stage Tree, the routing rules are instance-wise.At the same node, the features contribute differently to the routing of different instances.In the inference phase, the path with the highest probability is chosen, which is equivalent to: where i ∈ ℝ (d+1)×2 and T i,0 x means the logit that x is routed to the left node.Thus, |( i,0,j − i,1,j ) ⋅ x j | can be viewed as the contribution of feature j at node i for the instance x .We visualize the contribution of each feature to the node router through a pie chart to obtain the instance-wise routing rules.As shown in Fig. 7a, b, different features (i.e., BMI and Age) make the major contribution to the two instances that are both routed to the right node.Meanwhile, in Fig. 7a, c, two instances are routed to different children mainly by the same feature BMI.
Since the traditional soft trees (e.g., Soft Decision Tree and Budding Tree) are probabilistic, the instances are not directly routed to child nodes, which is difficult to interpret.Compared to probabilistic trees, One-Stage Tree directly routes an instance to a child node rather than weighting it by probabilities.Thus, One-Stage Tree is more interpretable.

Feature importance
Feature importance is an important way to explore data patterns.For hard trees, feature importance is calculated as the decrease in node impurity weighted by the probability of reaching that node.One-Stage Tree also provides the feature importance to explore the dataset.Due to the same discrete architecture of hard trees, One-Stage Tree calculates feature importance in the same way but weights the decreased impurity by | i,0,j − i,1,j | for each feature j at node i.
In Fig. 8, we show the feature importance of One-Stage Tree and CART in the dataset PimaIndian.We observe that two features, i.e., Glucose and BMI, play an important role in both trees.

Node instance distribution, node impurity, and predicted value
Benefiting from the discrete architecture, One-Stage Tree deterministically routes each instance to a leaf for prediction.As a result, the instance distribution and node impurity can be computed in the same way as for the hard tree.In Fig. 9, we show the instance

Discussion
Tabular data is generally dominated by tree models.One-Stage Tree can be seen as an attempt at deep learning on tabular data.Although One-Stage Tree inherits the advantages of the decision tree, it has the disadvantages of deep learning.For example, due to the use of gradient descent for optimization, the efficiency of constructing One-Stage Tree needs to be improved.Moreover, One-Stage Tree is a single decision tree.To achieve better performance, we need to further construct a tree ensemble model based on One-Stage Tree.Due to the continuous nature, we can perform joint tuning on all trees.

Conclusion and future work
In this work, we proposed One-Stage Tree, which retains the advantages of traditional decision trees as the inference model and improving learning through end-to-end training with back-propagation.Based on the continuous relaxation of soft trees, One-Stage Tree optimizes the node and architecture parameters jointly through a bilevel optimization problem.Moreover, One-Stage Tree leverages the reparameterization trick and proximal iterations to keep the tree discrete when training the continuous parameters.As a benefit, the performance gap between training and testing is reduced and the interpretability is maintained.The experimental results show that One-Stage Tree is effective on both classification and regression tasks and can outperform CART and the existing soft trees.
In the future, we plan to improve the efficiency of soft trees on GPU by parallelizing sequential decisions.Additionally, using ensemble methods such as bagging and boosting to build a forest of One-Stage Tree is also an important future work.

Appendix 1: Derivation of Equation (13) in budding tree
Similar to One-Stage Tree, Budding Tree (Irsoy et al., 2014) jointly optimizes the node and architecture parameters in the learning phase.Formally, for regression, given the training set D train = {x m , y m } N i=m , the optimization objective of Budding Tree is as follows.For simplicity, we omit the regularization term on i .f r (x; ) denotes the response at the root node calculated using Eq. (2)recursively.Specifi- cally, the response at node i is calculated as follows: where i ∈ [0, 1] denotes the architecture parameter.i = 0 indicates that node i is a leaf.
Budding Tree employs stochastic gradient-descent (the error is computed with respect to a single instance x ) to solve Eq. ( 19).Next, we focus on the optimization of the architecture f i (x; ) = 1 − i ⋅ i + i ⋅ s x; i 0 ⋅ f L(i) (x; ) + s x; i 1 ⋅ f R(i) (x; ) parameters .We omit for brevity.Define pa(i) as the parent of node i and i = L∕ f i as the responsibility of node i, by deriving L w.r.t.i , we have: If node i is the root node, we can easily get i = f i (x) − y according to Eq. ( 19).For other nodes, since f i (x) is calculated recursively, we can compute i as follows: In summary, we conclude that Eq. ( 13) holds based on Eqs. ( 20) and ( 21).

Appendix 2: Hyperparemeter search space of standard ML methods
To evaluate the performance of standard ML methods including MLP and SVM more accurately, we perform hyperparameter optimization with grid search.The hyperparameter search space of MLP and SVM are as follows.

Appendix 3: Details of gumbel tree
Gumbel Tree is a variant of One-Stage Tree that discretizes the tree architecture by the Gumbel Softmax instead of the lazy proximal step (Yao et al., 2020).Algorithm 2 shows the overall workflow of Gumbel Tree.As shown in Algorithm 2, both Gumbel Tree and One-Stage Tree (20) = pa(i) × i × s x; i 0 , if i is the left child pa(i) × i × s x; i 1 , if i is the right child solve the bilevel optimization problem in Eq. ( 9) by alternatively optimizing the node and architecture parameters.The main difference is the optimization strategy of the architecture parameters (Line 3 and Line 6).The optimization processes of ( , ) (Line 4 and Line 5) are exactly the same as One-Stage Tree.Unlike One-Stage Tree that searches the architecture parameters via proximal iterations, Gumbel Tree first obtains the discrete architecture γ (k) using the Gumbel Softmax (Line 3) (Maddison et al., 2014).Based on the discrete architecture γ (k) , we further calculate the optimal leaf values in closed-form (Line 4) and update the internal parameters (Line 5) on the training set.After forwarding one step, we optimize (k) with gradient decent on the validation set (Line 6).Additionally, both Gumbel Tree and One-Stage Tree employ the earlystopping mechanism to optimize the architecture parameters .

Fig. 3
Fig. 3 Comparison between One-Stage Tree and other ML Methods on classification datasets

Fig. 4
Fig. 4 Comparison between One-Stage Tree and other ML Methods on regression datasets

Fig. 5
Fig. 5 Effect of tree depth

Fig. 6
Fig. 6 Performance comparison between One-Stage Tree and Joint Tree (Bar chart shows the comparison in the test set, and line chart shows the comparison in the training set)

Fig. 9
Fig. 9 Instance distribution in leaves of One-Stage Tree trained on the dataset PimaIndian • The reparameterization trick and proximal iterations are leveraged to keep the tree discrete during training.In this way, we can reduce the performance gap between training and testing and maintain interpretability.• Extensive experimental results on both classification and regression tasks demonstrate that One-Stage Tree outperforms CART and the existing soft trees.

Table 1
Characteristic comparison between One-Stage Tree and other tree models including hard tree and existing soft trees

Table 2
Comparison between One-Stage Tree, CART, and the existing soft trees on classification datasets from UCIrvine aThe results obtained with the open-source code, Err.unknown bug when running the open-source code, Inst. is short for Instance, Feat. is short for Feature

Table 3
(Hehn et al., 2019))ne-Stage Tree and CART on regression datasetsIrsoy et al., 2012): a multivariate dense tree, of which all the paths to all the leaves contribute to the final prediction with different probabilities.It only supports classification tasks.We use the open-source code 6 with most stars on GitHub to obtain the experimental results.3.Budding Tree(Irsoy et al., 2014): a multivariate dense tree, which searches the tree architecture in the learning phase.It supports both classification and regression tasks.4.End2End Tree(Hehn et al., 2019): the state-of-the-art multivariate discrete tree, which is fully probabilistic at the training phase but becomes deterministic after an annealing process at the testing phase.It is open-source 7 and only supports classification tasks.

Table 5 p
-values for each pairwise comparison using the Nemenyi post-hoc test for the soft tree models (Confidence level = 0.05)

Table 6
Average Rank of One-Stage Tree and other ML Methods

Table 7
Mean number of internal nodes per tree depth

Table 8
Comparison results of One-Stage Tree with different validation sizes At the same time, the internal parameters is much less optimized.The number of the internal parameters is d (i.e., the number of features) times greater than the number of the architecture parameters.Thus, for the datasets with more features, training requires more instances (i.e., the smaller ).