โ˜‚๏ธ Decision Trees

Should I Carry an Umbrella?

Drag weather sliders, tune decision thresholds, and watch the tree re-draw live โ€” learning exactly how decision trees make multi-factor decisions!

๐ŸŒค๏ธ Weather Lab
๐ŸŒณ See the Tree
๐ŸŽฏ Tune Thresholds
๐Ÿ“Š Test Accuracy
๐Ÿ† Badge

How Decision Trees Make Decisions

โ“

Ask Questions

At each node, the tree asks a yes/no question: "Is rain chance > 60%?" Split the data based on the answer.

๐ŸŒฟ

Split the Data

Each split divides data into two groups. We want each group to be as "pure" as possible โ€” all umbrella or all no-umbrella.

๐Ÿƒ

Reach a Leaf

Follow the branches until you reach a leaf node. The leaf gives the final prediction: carry or don't carry!

โœ‚๏ธ

Pruning

Removing branches that don't improve accuracy. Simpler trees generalise better to new weather data!

โ˜‚๏ธ
Wizzy the AI Tutor
Welcome to the Weather Decision Lab! โ˜๏ธ Drag the sliders to set today's weather conditions. The decision tree will instantly tell you whether to carry an umbrella and show you exactly which conditions triggered the decision. Try different combinations!

Step 1 โ€” Set Today's Weather

โ›…
50%
Rain chance
60%
Humidity
50%
Cloud cover
25ยฐC
Temperature
20
Wind km/h
Decision path through the tree:
โ˜‚๏ธ
Wizzy the AI Tutor
Here's the full decision tree! The highlighted path in blue shows which branches the current weather follows. Each diamond is a question โ€” follow Yes or No until you reach a leaf. The tree depth is the number of questions it asks.

Step 2 โ€” Full Decision Tree

๐ŸŒณ Tree Info

Depth: 4 levels
Leaf nodes: 8 outcomes
Features used: 5
Current path: โ€”
Tree Legend:
๐Ÿ”ต Blue path = current weather route
โ˜‚๏ธ Green leaf = carry umbrella
โ˜€๏ธ Gray leaf = no umbrella needed
Diamond = decision node
Circle = leaf node (answer)
โ˜‚๏ธ
Wizzy the AI Tutor
Now you control the decision thresholds! Move the sliders to change where the tree draws the line. Lower rain threshold = more conservative (carry umbrella often). Watch the accuracy score change as you tune โ€” this is exactly what ML engineers do when optimising a model!

Step 3 โ€” Tune Decision Thresholds

Accuracy โ€”

๐ŸŽ›๏ธ Decision Thresholds

55%
65%
60%
30 km/h
Live accuracy on 20 test days
โ˜‚๏ธ
Wizzy the AI Tutor
Full accuracy report across 20 test weather days! ๐Ÿ“Š Green rows = correct prediction, red = wrong. Can you spot a pattern in the mistakes? Often the model fails at borderline cases โ€” days where rain chance is close to the threshold!

Step 4 โ€” Full Test Report

โ€”
Accuracy
โ€”
Correct
โ€”
Wrong
4
Tree Depth
Day๐ŸŒง๏ธ Rain๐Ÿ’ง Humidโ˜๏ธ Cloud๐Ÿ’จ WindTruthPredictedโœ“
โ˜‚๏ธ
Wizzy the AI Tutor
๐ŸŽŠ You've mastered decision trees โ€” one of the most interpretable and widely used ML algorithms! Weather apps, medical diagnosis, loan approval, fraud detection โ€” they all use decision trees or their powerful cousin, Random Forests!
โ˜‚๏ธ

Decision Tree Expert Badge!

You built a weather decision tree and tuned its thresholds to maximise accuracy!

โ˜‚๏ธ WhizzStep AI Lab
This certifies that
Student Name
has mastered Decision Trees & Threshold Tuning
Tree Builder
Threshold Tuner
Weather AI Expert
Accuracy: โ€” ยท whizzstep.in

Key Concepts Mastered

Decision Node

โ“ Ask a Question

Each internal node tests one feature: "Is rain > 55%?" Data is split into Yes and No branches.

Leaf Node

๐Ÿƒ The Answer

Terminal nodes that give the final prediction. No more splitting โ€” just the class label.

Gini Impurity

๐Ÿ“Š Split Quality

Measures how mixed the classes are at a node. Lower Gini = purer split = better decision boundary.

Threshold

โœ‚๏ธ Where to Split

The value that divides continuous features. Rain > 55% is a threshold. Tuning thresholds is key to accuracy.

Overfitting

๐Ÿ˜ต Too Deep

A very deep tree memorises training data but fails on new data. Pruning and max-depth limits help.

Random Forest

๐ŸŒฒ๐ŸŒฒ๐ŸŒฒ Many Trees

Train 100 decision trees on random subsets. Their majority vote is much more accurate than any single tree!