Learn practical skills, build real-world projects, and advance your career

Applications of Regression

Overview

In this lab you will apply regression to some realistic data. In this lab you will work with the automotive price dataset. Your goal is to construct a linear regression model to predict the price of automobiles from their characteristics.

In this lab will learn to:

  1. Use categorical data with scikit-learn.
  2. Apply transformations to features and labels to improve model performance.
  3. Compare regression models to improve model performance.

Load the dataset

As a first, step you will load the dataset into the notebook environment.

First, execute the code in the cell below to load the packages you will need to run the rest of this notebook.

import pandas as pd
from sklearn import preprocessing
import sklearn.model_selection as ms
from sklearn import linear_model
import sklearn.metrics as sklm
import numpy as np
import numpy.random as nr
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as ss
import math

%matplotlib inline

The code in the cell below loads the dataset which was prepared using steps from the Data Preparation lab.Execute this code and ensure that the expected columns are present.

auto_prices = pd.read_csv('Auto_Data_Preped.csv')
auto_prices.columns