Using linear regression to model housing prices

In the section, we will perform multivariate linear regression for the same dataset. In contrast to the previous section, we will use the sklearn library to show you several ways of performing linear regression models. Before we start the linear regression model, we will trim the dataset proportionally from both sides by using the trimboth() method. By doing this, we will cut off the outliers:

In [14]: import numpy as np         import pandas as pd         from scipy import stats         from sklearn.cross_validation import train_test_split         from sklearn.linear_model import LinearRegressionIn [15]: from sklearn.datasets import load_boston         dataset = load_boston()In [16]: samples , label, feature_names = dataset.data, ...

Get Mastering Numerical Computing with NumPy now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.