Skip to content
AI & Machine Learning Rich #decision-tree#cart#gini

Decision Tree: Gini Splits

At each node, find the split that most reduces impurity. Recursive partitioning of feature space.

A free, animated decision tree: gini splits you can read here or embed on any website, from Scrollchart.

Decision Tree: Gini Splits

Decision Tree: Gini SplitsRecursive axis-aligned splits minimize weighted Gini impurity at each nodex₁ < 0.44Gini drop 0.18x₂ < 0.50x₂ < 0.65

A 2D dataset partitioned recursively by axis-aligned splits. Each split is chosen to minimize weighted Gini (or entropy) across children. The tree grows alongside the partitioned 2D plot. Pruning by depth or min-samples-per-leaf shown. Overfitting at unbounded depth visualized.

Good for

  • Decision tree tutorials walking through Gini impurity and the CART splitting criterion
  • Random forest and gradient boosting explainers needing a clear base-learner description
  • Interpretable ML articles where tree visualisations serve as an audit trail

Source & accuracy

This decision tree: gini splits is an editorial illustration built to represent the concept accurately. Where it shows figures, they are typical or representative values chosen to make the relationship clear, not a single underlying dataset. The diagram and its explainer are reviewed and maintained centrally, and updated over time as understanding improves.

How Gini impurity guides the split choice

A decision tree works by recursively partitioning the input space into pure regions. At each node, the algorithm tests every possible threshold on every feature and picks the split that most reduces impurity (a measure of how mixed the class labels are in the resulting subsets). Gini impurity is one such measure: it is 0 if all samples belong to one class, and 0.5 for a binary split with equal numbers of each class.

The tree greedy-chooses whichever split minimizes Gini in the child nodes. If feature X at value 3.5 separates reds from blues better than feature Y at value 7.2, the algorithm picks X. This local optimization is fast but not globally optimal; a different first split might have led to a better tree overall. But greedy trees are interpretable and efficient.

Stopping and pruning to avoid memorization

Without restrictions, a tree can split until each leaf is pure (a single class). This overfits. Practical trees use stopping criteria (minimum samples per node, maximum depth) or pruning (removing splits that do not improve held-out accuracy). A tree at depth 3 might generalize better than one at depth 20, even if the deep tree trains with lower error.

The strength of tree-based methods is that each split is interpretable (you can ask why a sample went left at a node), and the method handles both numeric and categorical features naturally. The weakness is variance: small changes in data can drastically change the tree structure. Ensemble methods like random forests address this by averaging predictions across many trees.

Embed this diagram

Add this animated decision tree: gini splits to your own site. Copy one line of HTML, or use the embed builder for theme and sizing options.

Reference

What this is
A free, embeddable, animated decision tree: gini splits for any website.
Who uses it
AI/ML blogs, CS educators.
How to embed
Copy one line of HTML. No signup. No watermark. Works in WordPress, Webflow, Ghost, Substack, plain HTML.
File size
iframe embed, ~80 KB gzipped (loads on demand, does not block your page paint).
License
Free forever. Editorial explainer text included; updated centrally over time.

Embed format options

Copy the universal HTML snippet, the WordPress shortcode, or an iframe fallback - see the WordPress plugin page for details. Any format keeps the same Core Web Vitals profile and the same explainer text.

Embed snippet
<div data-scrollchart="decision-tree-splits" data-scrollchart-v="1"></div>
<script src="https://scrollchart.com/embed.js" async></script>

Frequently asked questions

Where can I get a free animated "Decision Tree: Gini Splits" for my website?
Scrollchart provides "Decision Tree: Gini Splits" as a free, embeddable animated diagram you can add to any website with one line of HTML. No signup is required and there is no watermark. The diagram and its explainer text are served from scrollchart.com, so the embed stays current without any maintenance on your end.
How do I embed a decision tree: gini splits in a developer or tech blog?
Copy the one-line snippet from the Scrollchart diagram page and paste it into your post HTML. It works in any static site generator, CMS, or hand-coded HTML page. The embed is a thin loader, not an iframe, so the content is fully in your DOM.