
Why Tree Ensembles Still Beat Deep Learning on Most Tabular Data
- كاتب موثّق
محتويات المقال
HistGradientBoostingClassifier with default settings and gets 0.996 in a few seconds. The scripts below rebuild a table like that synthetically, so you can rerun the whole story.
The common misconception
took over images, audio and text, so it looks like the general-purpose winner. Theory says a large enough network can approximate almost any function, so in principle nothing is out of reach. Papers proposing new tabular networks regularly report beating tree ensembles on their chosen benchmarks.
What actually happens
Targets in tables are irregular
Most columns don't matter, and networks pay for each one
Each column means something on its own
import numpy as npfrom sklearn.model_selection import cross_val_scorefrom sklearn.neural_network import MLPClassifierfrom sklearn.pipeline import make_pipelinefrom sklearn.preprocessing import StandardScalerrng = np.random.default_rng(0)X = rng.normal(size=(3000, 20)) # 20 columns, only the first 3 mattery = ((X[:, 0] > 0.5) & (X[:, 1] < 0)) | (X[:, 2] > 1.2) # rule-like targetQ, _ = np.linalg.qr(rng.normal(size=(20, 20))) # a random rotationnet = make_pipeline(StandardScaler(), # networks need scaled inputs MLPClassifier(early_stopping=True, random_state=0))for name, data in [("original", X), ("rotated", X @ Q)]: score = cross_val_score(net, data, y, cv=3).mean() print(f"Network, {name} columns: accuracy {score:.3f}")# Network, original columns: accuracy 0.871# Network, rotated columns: accuracy 0.880import numpy as npfrom sklearn.ensemble import HistGradientBoostingClassifierfrom sklearn.model_selection import cross_val_scorerng = np.random.default_rng(0)X = rng.normal(size=(3000, 20))y = ((X[:, 0] > 0.5) & (X[:, 1] < 0)) | (X[:, 2] > 1.2)Q, _ = np.linalg.qr(rng.normal(size=(20, 20)))trees = HistGradientBoostingClassifier(random_state=0) # no scaling neededfor name, data in [("original", X), ("rotated", X @ Q)]: score = cross_val_score(trees, data, y, cv=3).mean() print(f"Trees, {name} columns: accuracy {score:.3f}")# Trees, original columns: accuracy 0.996# Trees, rotated columns: accuracy 0.853Less work for an equal or better result
HistGradientBoostingClassifier handles missing values natively, takes categorical columns through categorical_features, and turns on early stopping by default above 10,000 samples. Google's decision forests course adds that forests have fewer hyperparameters with good defaults, and train much faster than neural networks on datasets under a million examples.
Where networks still earn their place
How to apply it in your project
Start with a tree-ensemble baseline Fit HistGradientBoostingClassifierorHistGradientBoostingRegressoron the raw columns with default settings. That score is the every other model must beat.Check a linear model too A regularized linear model takes seconds to fit. If it ties the trees, keep the simpler one. Tune a few knobs, not dozens learning_rate,max_leaf_nodes,min_samples_leafandl2_regularizationcover most of what tuning buys for gradient boosting.Try a network when you have a reason Lots of rows, text or image columns, or a need for learned embeddings are good reasons. Use the same cross-validation splits and a comparable tuning budget, or the comparison tells you nothing. Test the edges If future inputs can go beyond the training range, evaluate on the latest period you have, so a flat tree forecast shows up before production does.
Key takeaways
On typical tabular data, tree ensembles usually match or beat neural networks; a 45-dataset benchmark found them ahead at every tuning budget. Irregular targets, uninformative columns and meaningful column directions all favor trees. In the scripts, rotating the columns dropped trees from 0.996 to 0.853, while the network stayed near 0.87–0.88. Start with gradient boosting as your baseline; bring in a network for large data, unstructured inputs, or after a fair comparison.
📚 المصادر
Why do tree-based models still outperform deep learning on tabular data? — Grinsztajn, Oyallon, Varoquaux (arXiv) Tabular Data: Deep Learning is Not All You Need — Shwartz-Ziv, Armon (arXiv) Ensembles: Gradient boosting, random forests, bagging — scikit-learn User Guide Decision Trees — scikit-learn User Guide Decision Forests — Google for Developers
التعليقات (0)