#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
🌳 FREE · GINI OR ENTROPY

Decision Tree Visualizer: See How a Tree Picks Its Splits

Paste a small dataset and watch it become a tree of if-then rules.

  • 🌿 Text and number features
  • 📊 Gain for every root split
  • 🧾 Tree as text and diagram

How to use the Decision Tree Visualizer

  1. 1. Paste training dataUse a CSV with a header row, or keep the classic Play Tennis sample.
  2. 2. Pick criterion and depthChoose entropy or Gini and how deep the tree may grow.
  3. 3. Read the treeSee each split, leaf predictions and the gain of every feature.

How a tree chooses a split

At each node the tree tries every feature and keeps the one that makes the children purest. With entropy, purity is measured as H = −Σ p log₂ p and the score is information gain: parent entropy minus the size-weighted entropy of the children. With Gini, impurity is 1 − Σ p². Text columns split into one branch per category; number columns get the best threshold.

On the default 14-row Play Tennis data (9 Yes, 5 No), the parent entropy is 0.9403. Splitting on Outlook gives an information gain of 0.2467, more than Humidity (0.1518), Wind (0.0481) or Temp (0.0292), so Outlook becomes the root. Overcast days are all Yes and stop there; Sunny days split on Humidity and Rainy days on Wind.

Reading the result

  • Leaves show the predicted class. If a leaf is not pure, its class counts are shown.
  • Maximum depth limits how many questions the tree may ask. Deeper trees fit training data better but overfit more.
  • Training accuracy is measured on the same rows the tree learned from, so it is optimistic. Real projects keep a test set.
  • Gini vs entropy usually choose the same splits; Gini is slightly faster.

This tool builds multiway splits for text features (like ID3) and binary splits for numbers (like CART). scikit-learn's DecisionTreeClassifier makes binary splits on everything, so its tree can look different on the same data. Work through one split by hand in the entropy and information gain calculator.

Frequently asked questions

How big can my dataset be?

Up to 2,000 rows. Trees are built in your browser and nothing is uploaded.

Can it handle missing values?

No. Fill or drop missing cells first; an empty cell is treated as its own category.

Is the Decision Tree Visualizer free?

Yes, the Decision Tree Visualizer is free. The first time you build your first tree, you are asked for your name and WhatsApp number once. After that, this and every other Uncodemy tool opens straight away without the form.

More free tools

See all free tools