0

enter image description here

Above are images of Scatter plots on the famous Boston Housing Data. On the left, is an apparently linear plot of Number of Rooms to House Prices. On the right is plot of count of Lower Society Strata with House Prices.

I performed the Linear Regression on both these plots, following all the tuts available all over the internet. The best accuracy score I got was 0.66 or 66% after training the model. Clearly, the tuts I followed performed linear regressions on both the maps show above.

However, the red map is a non-linear one. Perhaps a log(x) function can transform it into a Linear map.

How can I perform a linear regression on both these charts independently - black - using Linear Regression and Red - using Log(x) transform. (In the Data set, the house pricing is given under the column MEDV) and be able to make predictions more accurately on the same dataset.

Best explained in steps. Plain English will do for an explanation.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
therion
  • 415
  • 4
  • 14
  • 1
    Plain English will hardly do, that's why we ask for a [MCVE], which should be straightforward with the Boston housing public data; but let's give it a try: what you did for performing linear refression, you will do again after first having created a new column in your dataframe with the log-transformed data. – desertnaut Sep 02 '19 at 12:23
  • Of course, to see if you are more accurate, you will have to *inverse transform* your dependent variable and compare it with the ground truth; at the end of the day, you are interested in predicting accurately the *dollar amount*, not the logarithm of it (despite the fact that the latter may give better "accuracy" in a model). – desertnaut Sep 02 '19 at 12:26
  • Oh ok. So I understand that I will create a new column called df['Log_Price'] and do the log-linear regression on that. And this way I won't effect the values of Price done through the Linear Regression. – therion Sep 02 '19 at 12:27
  • 1
    Yes, but of course be sure that you delete the original Price from the new dataframe – desertnaut Sep 02 '19 at 12:28
  • 1
    Again, beware of the inverse transormation required, in order to be sure that you compare apples to apples: https://stackoverflow.com/questions/48973140/how-to-interpret-mse-in-keras-regressor/49009442#49009442 – desertnaut Sep 02 '19 at 12:47

0 Answers0