application_vnd.jupyter.stderr_output_1.png
from keras.layers import Input, Dense

from keras.models import Model

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)

input_data = Input(shape=(2,))
firstlayer = Dense(2, activation='relu', name='input')(input_data)
ff = Dense(2, activation='relu', name='ff')(firstlayer)
secondlayer = Dense(1, activation='linear', name='prices')(ff)
MLPRegModel = Model(inputs=input_data, outputs=secondlayer)
MLPRegModel.compile(loss='mse', optimizer='rmsprop')
MLPRegModel.fit(X_train, Y_train, epochs=250, batch_size=10)