In [1]:
Copied!
# Import libraries
from sklearn.linear_model import LinearRegression
from sklearn.datasets import load_boston
# Import libraries
from sklearn.linear_model import LinearRegression
from sklearn.datasets import load_boston
In [2]:
Copied!
# Load the data from the boston house-prices dataset
boston_data = load_boston()
x = boston_data['data']
y = boston_data['target']
# Load the data from the boston house-prices dataset
boston_data = load_boston()
x = boston_data['data']
y = boston_data['target']
In [3]:
Copied!
# Make and fit the linear regression model
# TODO: Fit the model and Assign it to the model variable
model = None
model.fit(None, None)
# Make and fit the linear regression model
# TODO: Fit the model and Assign it to the model variable
model = None
model.fit(None, None)
Out[3]:
LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)
In [4]:
Copied!
# Make a prediction using the model
sample_house = [[2.29690000e-01, 0.00000000e+00, 1.05900000e+01, 0.00000000e+00, 4.89000000e-01,
6.32600000e+00, 5.25000000e+01, 4.35490000e+00, 4.00000000e+00, 2.77000000e+02,
1.86000000e+01, 3.94870000e+02, 1.09700000e+01]]
# TODO: Predict housing price for the sample_house
prediction = None
prediction
# Make a prediction using the model
sample_house = [[2.29690000e-01, 0.00000000e+00, 1.05900000e+01, 0.00000000e+00, 4.89000000e-01,
6.32600000e+00, 5.25000000e+01, 4.35490000e+00, 4.00000000e+00, 2.77000000e+02,
1.86000000e+01, 3.94870000e+02, 1.09700000e+01]]
# TODO: Predict housing price for the sample_house
prediction = None
prediction
Out[4]:
array([ 23.68420569])
In [ ]:
Copied!