2. An Introduction to Regression
Activity 2.01: Boston House Price Prediction with Polynomial Regression of Degrees 1, 2, and 3 on Multiple Variables
Solution:
- Open a Jupyter Notebook.
- Import the required packages and load the Boston House Prices data from
sklearn
into a DataFrame:import numpy as np import pandas as pd from sklearn import preprocessing from sklearn import model_selection from sklearn import linear_model from sklearn.preprocessing import PolynomialFeatures file_url = 'https://raw.githubusercontent.com/'\ Â Â Â Â Â Â Â Â Â Â Â 'PacktWorkshops/'\ Â Â Â Â Â Â Â Â Â Â Â 'The-Applied-Artificial-Intelligence-Workshop/'\ Â Â Â Â Â Â Â Â Â Â Â 'master/Datasets/boston_house_price.csv' df = pd.read_csv(file_url)
The output of
df
is as follows:Earlier in...