Search⌘ K
AI Features

Introduction to Decision Trees

Explore the basics of decision trees, their structure, and how they split data using entropy and Gini index. Understand their use in classification and regression, plus their strengths and weaknesses to better apply them in machine learning projects.

The uses of decision tree models are given below:

  • They are used for both classification and regression (CART).

  • They answer sequential questions and send us down a specific tree route to find the outcomes class.

  • They behave like “if this, then that” conditions ultimately yield a particular result.

Context

Let’s say someone wants to practice soccer. Before they decide to go out, they have a few questions about the weather.

Decisions Table

Outlook

Windy

Humidity

Playing

Sunny

T

High

No

Overcast

T

Normal

Yes

Rainy

T

Normal

Yes

Rainy

T

High

No

Sunny

F

Normal

Yes

.

.

.

.

.

.

.

.

.

.

.

.

As the decision table goes on, we can visualize whether or not to play based on the weather.

The decision tree above has the following features:

  • Root node: The starting point of the tree—for example, "Outlook".

  • Branches: Arrow lines connecting nodes, showing the flow from question to answer segments of the trees that connect the nodes.

  • Leaf node: Terminal nodes that predict the outcomes.

  • Internal nodes: ...