From the course: Machine Learning with Python: Decision Trees
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
How to build a regression tree in Python - Python Tutorial
From the course: Machine Learning with Python: Decision Trees
How to build a regression tree in Python
- [Instructor] In this exercise, we'll use a sample income data set to build a regression tree that predicts the salary of a worker based on their age and education level. Before we get started, know that this video is the first in the three video sequence that explains how to build, visualize, and prune a regression tree. We start by importing the Pandas package. Then we import the data into a data frame called income and preview it to make sure that the import worked as expected. Now that we have our data, let's try to understand it. First, we get a concise summary of the structure of the data by calling the info method of the data frame. From the summary, we can tell that there are 30 instances in the data set by looking at the range index. We can also tell that there are three features in the data set. Looking at the D type column of the summary, we see that the age column holds integer values. The education column…
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.