From the course: Machine Learning with Scikit-Learn
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
How to visualize decision trees using Matplotlib - scikit-learn Tutorial
From the course: Machine Learning with Scikit-Learn
How to visualize decision trees using Matplotlib
- [Instructor] How do you understand how decision tree makes predictions? One of the strengths of decision trees, are they're relatively easy to interpret, as you can make a visualization based on your model. This is not only a powerful way to understand your model, but also to communicate how a model works as stakeholders. In this video, I'll show you how decision trees, can be plotted with Matplotlid . The first thing you have to do, is import libraries. Take note that you're also importing tree. This is what actually plots to the decision tree. The next step is a loaded dataset, in this case is the Iris dataset. From there, you can split your data into training and test sets. This is really important for decision trees, as they tend to be a high variance algorithm. What this means, is they tend to overfit on the training set. The next step is to create a decision tree model. Before you can make a visualization based…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
What is supervised learning?54s
-
How to format data for scikit-learn1m 55s
-
Linear regression using scikit-learn4m 32s
-
Train test split1m 53s
-
Logistic regression using scikit-learn3m 55s
-
Logistic regression for multiclass classification3m 36s
-
Decision trees using scikit-learn3m 9s
-
How to visualize decision trees using Matplotlib2m 5s
-
Bagged trees using scikit-learn2m
-
Random forests using scikit-learn2m 41s
-
Which machine learning model should you use?1m 23s
-
-
-