When to use it
Predict a category or a number from a mix of numeric and categorical predictors when you want a model you can actually read: a flowchart of simple yes/no questions. Trees handle non-linear relationships and interactions automatically, need no scaling, and are the building block of random forests and boosting. Prefer a single tree when interpretability matters more than the last few points of accuracy.
When not to: Maximizing predictive accuracy matters more than interpretability (a random forest or gradient boosting ensemble will generally out-predict a single tree), the predictors are highly correlated (importance can arbitrarily split credit between correlated twins), or the training sample is small relative to the number of predictors (a single tree is high-variance and can look very different on a slightly different sample).
Step by step
Open it from the menu
Click Multivariate & ML in the menu bar; under Machine Learning choose Decision Tree (CART).
Fill in the form
Choose the columns: What you want to predict, Columns that may explain it. The form lists only columns whose type fits each field.
Check the options
The options start at their defaults: Max tree depth, Min samples per leaf, Pruning strength (α), CV folds, Random seed. Change one only when your question needs it.
Run the analysis
Press Run analysis. The Result Card opens on its Results tab.
What to choose in the form
| What you want to predict Outcome required | One categorical or binary or numeric column. Outcome to predict. Categorical or two-level → classification; continuous numeric → regression. |
|---|---|
| Columns that may explain it Predictors required | One numeric or categorical or binary column. One or more predictors. Numeric columns are used as-is; categorical columns are dummy-encoded (col=level). |
| Max tree depth | Maximum depth of the tree; 0 = grow fully. Limiting depth is the simplest overfitting control: judge it by the CV score. Default: 0. |
| Min samples per leaf | Minimum rows in a leaf. Raising it smooths the tree (less variance, more bias). Default: 1. |
| Pruning strength (α) | Cost-complexity pruning penalty per leaf (ISLR2 §8.1). 0 = no pruning; larger values give smaller trees. Default: 0. |
| CV folds | Cross-validation folds (stratified for classification), seeded for reproducibility. Default: 5. |
| Random seed | Seeds the CV shuffle and the tree's split tie-breaking so results are reproducible. Default: 42. |
How to read the card
The Results tab starts with what to know first (rows left out, checks that did not pass), then the interpretation in words and the Key Results; charts and assumption checks follow further down. Learn More explains the method in plain words. Read a Result Card covers all four tabs.
A worked example
Predicting penguin body mass from bill and flipper measurements, comparing a fully grown tree against a cost-complexity-pruned depth-3 tree.
Result: The fully grown tree: in-sample RMSE ~69g, cross-validated RMSE ~494g. The pruned tree: cross-validated RMSE ~388g (its in-sample RMSE is higher than the full tree's, but its cross-validated RMSE is lower).
The pruned, visibly simpler tree is the genuinely better model for predicting NEW penguins, even though it fits the training data less perfectly, a direct demonstration that in-sample fit and real predictive performance can point in opposite directions, and only cross-validation reveals which tree to trust.
From the Statistics Library.
The code tabs
Code gives this analysis as Python, R and MATLAB code (and SAS where the tab offers it), reading the data the way KernelStats did. Export sends the card to a report or to slides. See The Code tab.
Understand the statistics
Ask Oobi
Type one of these into Ask Oobi beside your data:
- Which yes/no questions about a penguin's measurements best identify its species, and how accurate is that flowchart on penguins the model never saw?
- Explain the decision tree (CART) in plain words.
- What does misconception: a model's training-set accuracy is its real-world performance mean?
Last reviewed November 16, 2026.
