text_plain_output_1.png
from sklearn import datasets

from sklearn.model_selection import train_test_split

from sklearn.preprocessing import StandardScaler

import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

import statsmodels.api as sm

boston = datasets.load_boston()

bos = pd.DataFrame(boston.data, columns=boston.feature_names)
target = pd.DataFrame(boston.target, columns=['MEDV'])
bos['MEDV'] = target['MEDV']

correlation_matrix = bos.corr().round(2)

X = bos[['RM', 'LSTAT']]
Y = target['MEDV']
model = sm.OLS(Y, X).fit()
predictions = model.predict(X)
model.summary()

X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.33, random_state=5)

scalar = StandardScaler()
X_train = scalar.fit_transform(X_train)
X_test = scalar.transform(X_test)