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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.