1
$\begingroup$

I am trying to do a prediction of real estate (prices are in millions).

The mean price for the dataset is 4 million.

I do not have any negative values in my dataset, but there are predicted values which are negative like -10 million.

Xgboost is also predicting negative values:

Xgboost: RMSE is 1.24 and R$^2$ is 0.81

Linear regression: RMSE is 1.54 and R$^2$ 0.74

What am I doing wrong? I tried to use $\log(\text{price})$ but the RMSE is bigger. What solutions can be found for this type of problem?

$\endgroup$

1 Answer 1

0
$\begingroup$

This can happen with regression, especially if the training data is too small and/or the test data has important differences with the training data. It can be caused by bias or overfitting, but it's more likely overfitting in your case so the solution is either to improve the training data or to simplify the model, for example by removing some features.

$\endgroup$
10
  • $\begingroup$ It's a dataset with more than 5 million of rows ,training data 4 millions rows for training and 1 million for test , I tried many solutions , repoved features, used logarithmic Price but nothing is working , i dont have outliers or négative values , $\endgroup$ Jun 18 at 17:35
  • 3
    $\begingroup$ I'm new to this site please don't take me wrong, but I have noticed most of your answers seem to be opinion-based with no apparent technical or theoretical support. Is it possible for you to offer references for some of your answers in the future? $\endgroup$ Jun 18 at 19:34
  • $\begingroup$ @Djakarta_zero you can investigate what i the cause by taking a few instances predicted with negative value, find whether there are any similar instances in the training set (probably not) and if possible which feature values are outliers wrt to the training set. You can also 'open the model' to see how the model ends predicting these values. Imho there's a good chance that you will obtain what I described: this happens for instances which differ too much from the training set. $\endgroup$
    – Erwan
    Jun 19 at 14:37
  • 1
    $\begingroup$ @user_2340102 this is a good question, but the answer is a bit complex. First, DSSE is a bit special in several ways compared to other SEs: (too) many questions, especially by newcomers who never come back; very few regular contributors, and very broad topic which means that contributors cannot be expert in everything. This results in a high proportion of unanswered questions, and a high proportion of questions/answers with zero votes (quite often even the OP doesn't bother upvoting or accepting). Additionally DSSE is clearly more open to practical questions ... $\endgroup$
    – Erwan
    Jun 19 at 14:46
  • 1
    $\begingroup$ @Djakarta_zero you realize that I'm not being paid for answering questions, right? I agree that my answers are not always relevant and sometimes even contain mistakes, it's unavoidable when one answers many questions. But if you want the level on this site to improve, don't hesitate: since you're not a beginner, you can answer questions. With more contributors offering good quality answers, the other contributors must improve their game too. We will see how good your answers are, and how motivated you are to keep contributing in the long run. $\endgroup$
    – Erwan
    Jun 21 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.