- Linear Regression

Linear regression example using scikit-learn.

We'll cover the following...

Regression is a common task for supervised learning, such as predicting the value of a home, and linear regression is a useful algorithm for making predictions for these types of problems.

scikit-learn provides both linear and logistic regression models for making predictions. We’ll start by using the LinearRegression class in scikit-learn to predict home prices for the Boston housing dataset.

Linear regression example

The code snippet below shows how to split the Boston dataset into different training and testing datasets and separate data (train_x) and label (train_y) objects, create and fit a linear regression model, and calculate error metrics on the test dataset.

Access this course and 1400+ top-rated courses and projects.