Why do tree-based models still outperform deep learning on tabular data?
arxiv.org
arxiv.org
I think if you spent months getting your data and model structure to a good place, you could certainly get a DL model to out-perform a gradient boosted tree. But why do that, when the GBT will be done today?
in a sense, most data in spreadsheets is compressed and deep learning models prefer to find their own compression that best suits the task at hand.
or in human terms: "these spreadsheets are garbage. i can't work with this. can you bring me the raw data please?" :)
> (although they're trying size ranges like [256, 512, 1024] as opposed to turning batching off entirely)
> The issue isn’t batch size as a parameter but rather needing to load the entire dataset into memory
what's stored in memory is an implementation detail. the key idea is that the tree algorithms are choosing an optimal based on the entire dataset, where sgd is working on small randomly chosen batches. turning off batching means computing gradients on the entire dataset instead.
although the typical bottleneck in gpu computing is moving data to and from the gpu's workarea (which is probably why you mention memory), there is nothing theoretical that says these computations could not be implemented in a streaming manner.
Take a look at [1] and go straight to the page 8, figure 2(b).
[1] http://proceedings.mlr.press/v48/taylor16.pdf
The paper talks about whole dataset training and one of the datasets used is HIGGS [2]. The figure 2(b) shows two whole dataset training approaches (L-BFGS and ADMM) vs SGD. SGD tops at the accuracy with which both whole dataset approaches start, basically.
[2] https://archive.ics.uci.edu/ml/datasets/HIGGS#
HIGGS is strange dataset. It is narrow, having only 29 features. It is also relatively long, about 11M samples (10M to train, 0.5M to validate and last 0.5M to test). It is also hard to get right with SGD.
But if you perform whole dataset optimization, even linear regression can get you good accuracy [3] (some experiments of mine).
One of the things that interests me about nominal AI applications is the extent to which they're sort of a Mechanical Turk or what I've heard called Artificial Artificial Intelligence. By which I mean it's sold as computer magic, but most of the magic is actually humans sneaking in a lot of human judgement. That can come through humans directly massaging the output or through human-driven selection of results. But I've also been wondering to what extent natural human intelligence is getting put in at the lower layers of the system, like feature engineering.
(That's literally what neural nets with relu as activation unit do.)
Statistical modeling: input -> feature extraction (manual) -> model selection (manual) -> output
Machine learning: input -> feature extraction (manual) -> model selection (auto) -> output
Deep learning: input -> feature extraction (auto) -> model selection (auto) -> output
So take a DL image classifier. The convolution + pooling layers perform automatic feature extraction. Back to OPs point, why use something like DL when you've already engineered your features?
The feature engineering they do here is absolutely horrible! They use a QuantileTransform and that’s it. They don’t even tune the critical hyper parameter of the number of quantiles. Do they always use the scikitlearn default of 1,000 quantiles? No wonder uninformative features are hurting- they are getting expanded into 1000 even more uninformative features! Also with a single quantile transform like that, the relative values of the quantiles are completely lost! If the values 86 and 87 fall into different bins, the model has literally no information that the two bins are similar to each other, or even that they come from the same raw input.
For a very large dataset a NN would learn its way around this kind of bone headed mistake. But for this size dataset, these researchers have absolutely crippled the nets with this thoughtless approach to feature engineering.
There is plenty more to criticize about their experiments, but it’s probably less important. E.g. Their HP ranges are too small to allow for the kind of nets that are known to work best in the modern era (after Double Descent theory has been worked out) - large heavily regularized nets. They don’t let the nets get very big and they don’t let the regularization get nearly big enough.
So. Bad comparison. But it’s also very true that XGB “just works” most of the time. NN’s are finicky and complicated and very few people really understand them well enough to apply them to novel situations. Those who do are working on fancy AI problems, not writing poor comparison papers like this one.
Ah, and then you could iterate within the resulting feature-engineering-suggestion space as a hyper-parameter between experiments, which could be optimized with e.g. https://github.com/HIPS/Spearmint . The papers write themselves!
Actually, the whole premise of Deep Learning is to learn proper feature representations from data with minimal data preprocessing. And it works wonderfully in CV and NLP but is less performant in tabular data. The paper indicates that there are several contributing factors to the DL underperforming.
I assume some day someone will be able to explain all this in information theoretic terms. I’m never sure if we’re comparing like with like (are the deep learning models we’re comparing against actually that deep, for example?) but clearly there’s something to the intuition that many small overfit models are more efficient than one big general model.
They link to this paper in their docs: https://www.tandfonline.com/doi/abs/10.1080/01621459.1958.10...
[1] https://arxiv.org/pdf/2009.09991.pdf [2] https://www.tensorflow.org/decision_forests/text_features
Is that really "medium"? That seems very small to me. MNIST has 60,000 samples and ImageNet has millions.
I think the title overstates the findings. I'd be interested to hear how these methods compare on much larger datasets. Is there a threshold at which deep learning outperforms tree-based models?
Edit: They touch on this in the appendix:
> A.2.2 Large-sized datasets
> We extend our benchmark to large-scale datasets: in Figures 9, 10, 11 and 12, we compare the results of our models on the same set of datasets, in large-size (train set truncated to 50,000 samples) and medium-size (train set truncated to 10,000 samples) settings.
> We only keep datasets with more than 50,000 samples and restrict the train set size to 50,000 samples (vs 10,000 samples for the medium-sized benchmark). Unfortunately, this excludes a lot of datasets, which makes the comparison less clear. However, it seems that, in most cases, increasing the train set size reduces the gap between neural networks and tree-based models. We leave a rigorous study of this trend to future work.
I thought the biggest leap in NN and deep learning in recent history was the realization that we need a ton of data to get maximal effectiveness from them; it now sounds counterproductive to forget this and cry they don’t work well with 10,000 rows.
It is an important lesson to be communicated.
I'd like to present a conjecture: everyone thinks their data is big until they have worked on much larger dataset. ("We have 10k samples, it is quite big!" -> "We have 1m data records, is quite big!" -> "Our process outputs that much per day")
For example, LightGBM and XGBoost allow some regularization terms, but the variance/bias is still mostly controlled by globally setting the max depth and max node count (and then parameter searching to find good settings).
Surely there must be more powerful and sophisticated ways of deciding when to stop building each tree than counting the number of nodes? If this was neural nets there would be a hundred competing papers proposing different methods and arguing over their strengths and weaknesses.
I'm not sure whether the problem is that neural nets are just fundamentally more sexy, or that in order to make SOTA improvements in GBMs you need to dive into some gnarly C++. Probably both.
My take? management agenda to build plug-and-play researchers (humans on jobs), rather than domain specialists. DeepLearning fits that description with all-plumbing, all-the-time.. domain specialists want graduate school, weekends and health benefits..
Because it's not this.
Deep learning researchers are specialists in their specific technologies. For example recent advances in transformers not withstanding, it takes quite a long time for say someone who knows how to build deep learning models on images using CNNs to come up to speed on how build good natural language processing models.
Limiting a tree by its depth is a very general global parameter for a tree. One could try to use any kind of criteria for deciding when to stop making more child nodes in a tree, depending on what information is locally available and that depends on how the tree algorithm is actually implemented. So people doing Kaggle challenges would have to dig into the source code of the tree implementation, then change things there, to modify locally available knowledge, in order to allow for more fine grained decision making at each node.
That is only the constructive side of things, when the tree is created. Even more powerful is the post processing / destructive / prunning side of things, because theoretically the whole tree structure can be taken into account, when deciding what branch to cut.
I think the GP is referring to research in the area of what other useful things one can come up with here. As far as I know, these are not the usual things people do in Kaggle challenges. Correct me if I am wrong.
Another example: modern GBM implementations all use binary trees. How would they perform with ternary trees? Or k-way trees for larger k plus some additional soft penalty that encourages minimizing the number branches, unless the information gain is really worth it?
(You can simulate ternary trees with binary, but the splitting behavior is different because ternary can more easily identify good splitting regions in the middle range of the histogram values.)
This seems like such a basic structural question, but the only relevant search result was this downvoted Stack Exchange question from 5 years ago: https://stats.stackexchange.com/questions/305685/ternary-dec...
There are lots of papers on ternary trees in old-school contexts like Ternary Decision Diagrams etc., but nothing relevant to the context of modern tree ensemble performance. Or maybe I'm just bad at searching?
(I implemented this and saw a small accuracy increase from ternary on large datasets, but much worse training speed because you get less mileage from the histogram subtraction trick. Maybe the accuracy would be even better with a more clever choice of soft penalty.)
So even if you can fit a more compact forest that performs well through clever regularization its usually better/faster in practice to grow more simple trees with more randomization and let overfitting average out.
and random forests here: https://mlu-explain.github.io/random-forest/
It’s also worth noting that a recentish paper shows neural networks can perform well on tabular data if well-regularized: https://arxiv.org/abs/2106.11189v1?utm_source=jesper&utm_med...
Prior knowledge can prevent the pitfalls of automatically built models.
Trees may be better than NNs because they overfit less but you can overfit even less with a bespoke model. For example, I've seen an automatically generated tree made to tune the efficiency of a factory end up using as a main feature "be after a specific date" because a machine was upgraded on that date and so the learning algorithm latched on to that unactionable piece of data as a main predictor for the model.
This was an easy fix, to not feed timestamp data to the model but there are lots of more subtle cases like this and I've seen people spend much time cleaning and "tweaking" the input data to get the answers they want out of their ML models.
If you have to try to make your ML model behave by manually selecting what data to feed it, you might as well go all the way and build a clean causal model yourself that reflect your priors and domain knowledge about the subject.
I have an ML background but I often get more performance out of my models by doing something along the lines of what a Bayesian statistician would do.
Of course with highly dimensional data like pixels in images you almost have no choice to use NNs. There's no way to hand-build these models.
For example, not too long ago I was trying to estimate and predict ATM usage and considered using days of the week as a feature. The simplest case is a single node tree that assumes every day of the week has similar usage. You just calculate mean and variance.
But then, a lot of ATMs have different usage patterns on weekends than weekdays. So I considered a split into two groups, calculating different mean/variance for weekend days and week days. I could have tried different groupings of days but those two were easy to understand for users, covered most cases I was interested in with less risk of overfitting given the amount of data that I was working with (with more data I might have considered more splits even take into account special days like holidays). The more splits the more data you need to train the model, especially if you want not just a point estimate but an idea of variance (more parameters to estimate require more data).
The decision whether to split or not can be done on a per ATM basis cross validating the splitting strategy by assessing a fleet of ATMs.
People optimize different things in these kinds of problem. Here https://www.saedsayad.com/decision_tree_reg.htm for example they try to reduce prediction variance. Oftentimes decision trees try to optimize information gain or gain ratio (https://en.wikipedia.org/wiki/Information_gain_(decision_tre...) Gain ratio seems like a pretty ad-hoc technique to me so to prevent over-fitting and select the correct model (to split or not), I sometimes use a relative entropy penalty on the trained parameters kinda like described here: http://www.inference.org.uk/mackay/itprnn/ps/343.355.pdf. I've never used it but apparently if you have problems where you can't calculate that parameter relative entropy, there are approximation techniques such as https://en.wikipedia.org/wiki/Bayesian_information_criterion.
Then there's things I sometimes do with hyperparameters to improve performance like mixing into individual ATM data fake data points that represent the prior for a wider group or class of ATMs. Again using common sense to adjust those priors (and always cross validating my tweaks against real data).
I'm also not too worried that I could get better performance using NNs as Bayesian methods are basically proven to be near optimal under some fairly reasonable assumptions and the more automatic methods overfitting or latching on artifacts of imperfect inputs actually have worse performance as the article points out.
Until you get to really high dimensional problems, this is a better approach imo.
To elaborate: Are you coding up this bayesian logic as part of the training process, and then you run this code 200 times to end up with 200 trees? That code mixes the hand built rules with the normal approach to tree construction (random split location, random feature choice out of N features, etc)
The following step which I didn't mention, was to use the trees for generating predictions into the future. Little monte carlo simulations using one of the tree (selected using that relative entropy methods, you could even use a weighted mix of both trees) that I run a few thousand times for each ATM and to generate a forecasted range of when the ATM is going to run out of cash.
[0] https://towardsdatascience.com/n-beats-beating-statistical-m...
However, it omits to cite the highly relevant SRBench paper from 2021, which also carefully curates a suitable set of regression benchmarks and shows that Genetic Programming approaches also tend to be better than deep learning.
https://github.com/cavalab/srbench
cc u/optimalsolver
With tabular or nested data a human has already done a lot of work to organize that data in a machine friendly form - much of the feature engineering is performed by the data schema itself.
And it appears that there are some html docs in the python repo, but they don't seem to be hosted anywhere. So its not clear how to use it either.
[1] https://research.cs.wisc.edu/machine-learning/shavlik-group/...
Tabular data doesn't have any of that.
[1] https://github.com/tensorflow/decision-forests [2] https://github.com/google/yggdrasil-decision-forests
Bonus question: are the stats you're mentioning publically available?
Since the server doesn't work for all types of data, and probably folks that are experts in ML would do their own hyperparameter tuning, and custom models, this leads to the bias on the type of datasets that are compete.
But this share have been consistent over many months of various unrelated datasets, I believe.
Categorical > one hot encoding > deal with new categories in test time (sklearn does this, but it's really slow and clunky)
Numerical > either figure it out the data distribution for each column and normalize by that or normalize everything by z score. Found an outlier?? Oops, every feature collapsed to 0
Can you that for 10 features? Sure, now try it again with 500, it's not fun
Ok, now that you've done all that you can begin training and possibly get some reasonable result.
Compare that with tree models: data>model>results
https://tech.instacart.com/deep-learning-with-emojis-not-mat...
The thing about deep learning is that the number of parameters is astronomical.
One explanation is that a very large model effectively fits several models and penalises over-fit models itself.
One big problem I can see with this approach (maybe compared to over forms of regularization) is that it might be very space/memory inefficient. But if you've got a big budget I think it's a surefire way to make sure your model performs as well as possible (without having to tune hyperparameters too much or deal with local minima that probably happens at near-capacity networks).
The final output of a random forest regression for example is just the average of all the final prediction nodes of the individual trees, which thanks to bootstrapping are decorrelated. So - adding more trees does not tend to alter predictions very much.
Overfitting is generally a function of the the size of your data and the complexity expressible in your model.
I think Hastie & Tibshirani have an article on this.
Sibling comments have some nuanced discussion of overfitting in tree-based models
0: https://www.stat.berkeley.edu/~breiman/RandomForests/cc_home...
Neural nets have far more parameters and so are susceptible to overfitting with more training time.
I can represent an image as a table of RGB values. I can represent hierarchical data as a table of unnested values.
What I am now looking at is if it's possible to feed in world knowledge from models like beer as features to XGBoost but without resorting to creating templates for table rows
That’s less computation when traversing nodes in a set which can result in either an exponential or logarithmic difference depending upon the data and means of traversal. This holds true almost universally.
I think that's perhaps the difference?
Assuming you can define a good distance measurement how cool is it to use every piece of data. And with no training.
I wonder how they compare against tree based models on tabular data just in accuracy.
Then we need to decide on an order to these comparisons - what about using entropy derived from the training data?
Then as a further improvement, what if the order need not be constant, depending on which group the data point is closer to? And what if not all dimensions need to be considered?
Before you know it, woah! You've reinvented trees!
This comment is meant as a joke
And tree based models is not what you described, at most that could be a tree classifier.
EDIT: First of all sorry for my comment, I think you did not like it. My point is that what you state as obvious on how tree based methods work is most probably not what makes them powerful but the fact that you have a bunch of them. To me if there is some intuition, statistics is more prevalent than separating spaces in hyperplanes.
Here you can see the boundaries of a random forest compared to a single tree, the more dimensions you add the more blurry and unintuitive in terms of hyperplanes it gets:
https://scikit-learn.org/stable/_images/sphx_glr_plot_classi...
I also suspect your hypothesis is not correct. The top row of your link is a good example. The NN tries to infer a gradient but that's really tough to do with limited data. That is to say, the tree based models will locally fit their partitions to the exact training data and the NN will try to view it in the big picture filling in the gaps. Tree based model works better for most real world tabular data.
The paper concludes something similar:
> This superiority is explained by specific features of tabular data: irregular patterns in the target function, uninformative features, and non rotationally-invariant data where linear combinations of features misrepresent the information.
I daresay my perspective is better aligned with the paper than yours. Are YOU trying to replace the publication with your 4 lines?
And no, I am trying to replace what I consider is a wrong intuition (tree methods are strong models mostly because single trees separate data in hyperplanes) with my 4 lines. This is just my opinion.
How would that work for effectively finding the boundary of an ellipse or a spiral shaped set?