From the course: Machine Learning with scikit-learn

Unlock this course with a free trial

Join today to access over 25,100 courses taught by industry experts.

Build a decision tree

Build a decision tree

Decision trees are one of the most interpretable and powerful models in machine learning. They don't rely on overly complex math or hidden layers. Instead, they mimic how people make decisions. At each step, the model asks a simple question about one feature, splits the data in a way that maximizes the information gained, and continues branching until it reaches a conclusion. By the end of this lesson, you'll be able to build and visualize a decision tree that shows exactly how your model makes predictions. Open the notebook 0207 Decision Tree in Google Colab. Now examine this sample decision tree for Should you wear a rain jacket? A decision tree works by starting at a root node, asking a simple yes or no question, branching based on the answer, and eventually landing on a leaf node that represents the final outcome. Here, start with is it raining, which is the root node, and follow the branches until you reach a leaf like wear rain jacket or take umbrella only. This is the same…

Contents