Boston Housing Data: This dataset was taken from the StatLib library and is maintained by Carnegie Mellon University. This dataset concerns the housing prices in housing city of Boston. The dataset provided has 506 instances with 13 features.
Let’s make the Linear Regression Model, predicting housing prices
Inputing Libraries and dataset.
Shape of input Boston data and getting feature_names
Converting data from nd-array to dataframe and adding feature names to the data
Adding ‘Price’ column to the dataset
Description of Boston dataset
Info of Boston Dataset
Getting input and output data and further splitting data to training and testing dataset.
Applying Linear Regression Model to the dataset and predicting the prices.
Plotting Scatter graph to show the prediction results – ‘ytrue’ value vs ‘y_pred’ value
Results of Linear Regression i.e. Mean Squred Error.
As per the result our model is only 66.55% accurate. So, the prepared model is not very good for predicting the housing prices. One can improve the prediction results using many other possible machine learning algorithms and techniques.