shapesinfinity.
Learn AI · Beginner · 3 min

How decision trees help AI choose

Can a computer learn by asking yes-or-no questions?

Decision tree structure and flow
Data (examples)Root: first questionBranch: yes or noLeaf: final answerTree grows too deep

Start at the top. Answer each question. Follow the branch. Reach a leaf with the answer.

goes inthe AI workscomes outwatch out

In simple words

A decision tree is like a flowchart that asks questions to sort things. Each answer leads to a new question until you reach an answer.

The real definition

A decision tree is a supervised learning model that makes decisions by splitting data into groups using yes-or-no questions. It mimics how humans think through choices.

Like… Playing 20 questions

You guess what someone is thinking by asking yes-or-no questions. Each answer narrows down the options until you find it. The decision tree does exactly this with data.

But: Real 20 questions stops when you guess. Trees may ask too many questions and memorize instead of learning.

You see it every day

on your phone

Email spam filter

A tree asks: "Is the sender unknown?" Then "Does it ask for money?" The AI sorts email as spam or safe.

out in the world

Animal classifier

A tree asks: "Does it have feathers?" Then "Can it fly?" The AI tells you if it is a bird.

at work

Loan approval

A tree asks: "Is income above the limit?" Then "Is credit score good?" The AI decides yes or no.

Step by step

  1. 1

    Gather training data

    Collect examples with labels. Labels are the right answers the AI should learn.

  2. 2

    Pick the best question

    Find a yes-or-no question that splits the data into two clean groups.

  3. 3

    Repeat for each branch

    Ask more questions on each group. Stop when each leaf has only one type.

  4. 4

    Stop at the right depth

    Stop growing when leaves are pure or the tree gets too big.

Remember

Trees ask yes-or-no questions to sort dataEach question splits data into two groupsLeaves (endpoints) hold the final answerToo-deep trees memorize instead of learningFast and easy for humans to understand

Memory trick

Think of a real tree: root at top, branches split left and right, leaves at the bottom are where answers hide.

Words

Decision tree de-SIZ-un TREE
A model that sorts data by asking yes-or-no questions in order.
Root ROOT
The first question at the top of the tree.
Branch BRANCH
A path that follows a yes or no answer from a question.
Leaf LEAF
The endpoint where the tree gives the final answer.
Supervised learning SOO-per-VYZD LER-ning
Teaching AI using examples that already have correct answers labeled.
Split SPLIT
Dividing data into two groups using a yes-or-no question.
Depth DEPTH
How many questions the tree asks from root to leaf.
Overfitting OH-ver-FIT-ing
When a model memorizes examples instead of learning real patterns.

Check yourself

quick check

What does a decision tree ask at each step?

Hint

Think of how you play 20 questions.

quick check

A bank trains a tree to approve loans. The tree asks ten questions before deciding. What is the risk?

Hint

Deeper trees learn less. They memorize more.

think

Why is a decision tree easier to understand than other AI models?

Show a good answer

Because you can follow the path from root to leaf and see why it decided something. Each question and answer makes sense to humans.

Tell a friend

“A decision tree is an AI that learns by asking yes-or-no questions to sort things into groups.”

People also ask

Can a decision tree answer questions other than yes or no?

Yes. Each question can have more than two answers. But yes-or-no splits are simplest. More options make trees more complex.

How deep should a decision tree be?

Shallow trees learn patterns well. Very deep trees memorize examples and fail on new data. Balance is key.

Are decision trees used in real AI systems today?

Yes. Banks use them for loans. Doctors use them for diagnosis. Stores use them for recommendations. They are fast and trustworthy.