MISSION 90

Building a Decision Tree

In the last lesson, we got an introduction to decision trees, including entropy and information gain. In this lesson, we'll build on those concepts to construct a full decision tree in Python and use it to make predictions.

In this lesson, we'll use the ID3 Algorithm for constructing decision trees to accomplish constructing a full decision tree. This algorithm involves recursion and an understanding of time complexity. Towards the end of this lesson, you will learn how to make predictions automatically as well as how to make multiple predictions at once using lambda functions

While exploring how to build your own decision tree using the ID3 algorithm, you'll continue to work with United States Census data from 1994 in efforts to try and predict if someone makes above or below 50,000 USD per year based on factors such as marital status, age, type of work, and other data reported.

As you work through each concept, you’ll get to apply what you’ve learned from within your browser so that there's no need to use your own machine to do the exercises. The Python environment inside of this course includes answer checking so you can ensure that you've fully mastered each concept before learning the next concept.

Objectives

  • Learn how to build a decision tree.
  • Learn how the ID3 algorithm works.
  • Learn how to make predictions using decision trees.

Mission Outline

1. Introduction to the Data
2. Overview of the ID3 Algorithm
3. Walking Through an Example of the ID3 Algorithm
4. Determining the Column to Split On
5. Creating a Simple Recursive Algorithm
6. Storing the Tree
7. Storing the Tree
8. Printing Labels for a More Attractive Tree
9. Making Predictions With the Printed Tree
10. Making Predictions Automatically
11. Making Multiple Predictions
12. Next Steps
13. Takeaways

decision-trees

Course Info:

Intermediate

The median completion time for this course is 6.4 hours. View details

This course requires a premium subscription. This course has four missions and one guided project.  It is the 22nd course in the Data Scientist in Python path.

START LEARNING FREE

Take a Look Inside