Boston Housing: Prediction of House Price

Boston Housing Data set load (Head And Tail )Lookup

Tail view of Dataset

EDA- Exploratory Data Analysis


Summary of Boston Dataset



Linear Regression

sns.regplot(X, y,robust=True);
plt.xlabel(‘average number of rooms per dwelling’)
plt.ylabel(“Median value of owner-occupied homes in $1000's”);

sns.jointplot(x=’RM’, y=’MEDV’, data=df, kind=’reg’, size=10);;

X = df[‘LSTAT’].values.reshape(-1,1)
y = df[‘MEDV’].values, y)
sns.regplot(X, y);
plt.xlabel(‘% Lower status of the population’)
plt.ylabel(“Median value of owner-occupied homes in $1000's”);

sns.jointplot(x=’LSTAT’, y=’MEDV’, data=df, kind=’reg’, size=10);;

Robust Regression

Performance Evaluation of Regression Model

Method 1: Residual Analysis

plt.scatter(y_train_pred, y_train_pred — y_train, c=’blue’, marker=’o’, label=’Training data’)
plt.scatter(y_test_pred, y_test_pred — y_test, c=’red’, marker=’*’, label=’Test data’)
plt.xlabel(‘Predicted values’)
plt.legend(loc=’upper left’)
plt.hlines(y=0, xmin=-10, xmax=50, lw=2, color=’k’)
plt.xlim([-10, 50])

Method 2: Mean Squared Error (MSE)

Method 3: Coefficient of Determination

SSE: Sum of squared errors

SST: Total sum of squares

Thank you



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Data Scientist|Machine Learning|Python|R|MYSQL•|AI-NLP