text_plain_output_1.png
from sklearn.linear_model import LinearRegression

from sklearn.linear_model import LinearRegression

from sklearn.metrics import mean_squared_error

from sklearn.model_selection import train_test_split

import matplotlib.pyplot as plt

import numpy as np

import pandas as pd

import seaborn as sns

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set
data = pd.read_csv('../input/boston-housing-dataset/HousingData.csv')

data = data.dropna()
data

X = data.drop('MEDV', axis=1).values
Y = data['MEDV'].values
X

Room_number = X[:, 5]
Room_number = Room_number.reshape(-1, 1)
Y = Y.reshape(-1, 1)

from sklearn.linear_model import LinearRegression
regression = LinearRegression()
regression.fit(Room_number, Y)
regression_line = np.linspace(min(Room_number), max(Room_number))

from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2, random_state=30)
regression_all = LinearRegression()
regression_all.fit(X_train, Y_train)
Y_prediction = regression_all.predict(X_test)

from sklearn.metrics import mean_squared_error
Y_prediction = regression_all.predict(X_test)
error = np.sqrt(mean_squared_error(Y_test, Y_prediction))
print('error: {}'.format(error))