About Decision Tree Builder
This decision tree builder is free, needs no sign-up and runs in your browser, so your data is never uploaded. Paste a CSV with a header row, choose the target column, pick Gini impurity or entropy, set the maximum depth and the minimum rows to split, and the tool builds a classification tree and draws it as a diagram you can fold and scroll.
Alongside the tree you get the training accuracy and, if you reserve a test share, the accuracy on rows the tree never saw, a ranked feature importance chart, the impurity and information gain at the root, and the whole tree written out as if-then rules. Three sample datasets are built in: Fisher's iris flowers, a 30-passenger Titanic subset and the classic play-tennis table.
Decision trees are among the easiest models to understand, because every prediction is a path of yes-or-no questions. They are also easy to overfit, and the gap between training and test accuracy shown here is the quickest way to see it happen.
How to use Decision Tree Builder
- Pick a sample dataset, or paste your own CSV with a header row.
- Choose the target column, the one you want to predict. It should have a handful of classes.
- Choose Gini impurity or entropy, and set the maximum depth and the minimum number of rows needed to split a node.
- Set a test share, for example 20%, to hold some rows back and measure accuracy on unseen data.
- Read the accuracy figures, then look at the tree. Tap a box to fold its branch, or scroll sideways on a small screen.
- Check the feature importance chart, and open the rules to copy the tree as text.
Features
- Numeric columns split on a threshold; text columns get one branch per value.
- Gini impurity or entropy as the split quality measure.
- Maximum depth, minimum rows to split and a repeatable train and test split.
- A tree diagram in responsive SVG with foldable branches, scrollable on phones.
- Feature importance as the share of total impurity reduction.
- Root impurity and information gain, so you can check a textbook calculation.
- The tree as if-then rules, which you can copy.
- Iris, a Titanic subset and play-tennis built in, with their sources stated.
How a tree chooses its splits
At each node the tool tries every column. For a numeric column it tries a threshold halfway between each pair of neighbouring values; for a text column it splits into one branch per value. It keeps the split with the greatest impurity decrease, then repeats inside each branch until a node is pure, the depth limit is reached or too few rows remain.
Gini impurity is the chance that two rows drawn at random from the node have different classes. Entropy measures disorder in bits. The gain of a split is the parent's impurity minus the average impurity of its children, weighted by size. Ties go to the earlier column.
Gini = 1 - sum of p_k^2
Entropy = - sum of p_k log2(p_k)
gain = impurity(parent) - sum of (n_child / n) x impurity(child)Worked examples
Iris, Gini, depth 3, 20% test gives root split: petal_length <= 2.6
Training accuracy 96.7%, test accuracy 100%. The root separates setosa from the other two species perfectly, which is why it comes first.
Play tennis, entropy, depth 1 gives root split: outlook, gain 0.247
Entropy of the 9 yes and 5 no rows is 0.940 bits. Splitting by outlook leaves 0.693 bits on average, a gain of 0.247, the textbook value.
Gini and entropy for a two-class node
| Share of class A | Gini impurity | Entropy (bits) |
|---|---|---|
| 0 or 1 (pure) | 0 | 0 |
| 0.1 or 0.9 | 0.18 | 0.469 |
| 0.25 or 0.75 | 0.375 | 0.811 |
| 0.5 (most mixed) | 0.5 | 1 |
Good to know
Overfitting and how to see it
A tree with no depth limit keeps splitting until every leaf is pure, so it memorises the training rows, noise included. Training accuracy then reaches 100% while accuracy on new rows falls. Set a test share and raise the depth: when the training figure keeps climbing but the test figure stalls or drops, the tree is overfitting. Limiting depth or requiring more rows to split are the simplest remedies.
Limits of this tool
It builds classification trees only, with one test split rather than cross-validation. Missing values are handled by skipping rows with an empty cell. Text columns with many different values (such as an ID or a name) split into one branch per value, which makes a perfect-looking but useless tree, so leave those columns out. Small datasets such as the Titanic subset here give unstable trees and noisy test accuracy.
Privacy: how it works
- Your CSV is parsed and the tree is grown in your browser tab. Nothing is sent to Ulkaa or anyone else.
Tips
- Remove ID columns, names and anything that would not be known when you need to predict.
- Compare Gini and entropy on your data. They usually pick the same splits and differ only in the details.
- Fold the branches of a big tree and read the top levels first. Those hold the strongest signals.
- The test split is random but repeatable, so the same settings always give the same numbers.
Frequently asked questions
Is it really free?
Yes. There is no price, no trial and no credit card. Ulkaa Tool does the work with your own device, so there is no server bill to pass on to you.
Do I need an account?
No. There is no sign-up and no login. Open the page and use it. An Ulkaa account is not needed for anything on this tool.
Does it run in my browser?
Yes. Your CSV data are processed by code running in your browser tab, on your own device.
Is my data uploaded?
No. Your CSV data are never sent to Ulkaa or to anyone else. You can check this yourself by watching the Network tab in your browser developer tools while you use the tool.
What is a decision tree?
A model that predicts by asking a series of yes-or-no questions about the features, each question splitting the rows into branches, until a leaf gives the predicted class.
What is the difference between Gini impurity and entropy?
Both measure how mixed a node is, and both are zero for a pure node. Gini is the chance of drawing two rows of different classes; entropy measures disorder in bits. They give similar trees in practice.
How is information gain calculated?
Take the entropy of the parent node and subtract the average entropy of the children, weighted by how many rows go to each. The split with the highest gain is chosen.
How do I stop a decision tree overfitting?
Limit the maximum depth, require more rows before a node may split, and check accuracy on held-out rows, not just the training data.
How is feature importance computed?
Each split reduces impurity by some amount weighted by the rows it covers. A feature's importance is its share of the total reduction across the tree.
Which data do the samples use?
Iris is Fisher's 1936 data from the UCI repository. Play-tennis is the 14-row table from Quinlan's ID3 paper. The Titanic sample is a 30-passenger teaching subset taken from the first rows of the public Stanford CS109 titanic.csv passenger list.
What format does my CSV need?
A header row, then one row per case, separated by commas, tabs or semicolons. Rows with an empty cell are skipped. Up to 5,000 rows and 60 columns.
Can it predict a number?
No. It builds classification trees, so the target should have a few distinct classes. A target with more than 20 different values is rejected.
Popular Decision Tree Builder pages
- Play Tennis Decision TreeThe textbook 14-day table, turned into a tree with entropy and information gain.
- Titanic Survival Decision TreePredict who survived from class, sex and age with a small, readable tree.
- Gini Impurity CalculatorSee the Gini impurity of a node and of its children after the best split.
- Information Gain CalculatorCompute the entropy of a node and the information gain of the best split.
- Decision Tree Feature ImportanceRank the columns of your data by how much a tree depends on them.
- Decision Tree OverfittingGrow an unrestricted tree and compare its training and test accuracy.
- Entropy vs Gini in a Decision TreeSwitch between the two split criteria and compare the trees they build.