1
$\begingroup$

I have been building a linear regression model with around 150 rows of data. I checked the correlation of the parameters with the target variable and tried to keep only them as I have less data and wanted to have a simple linear model.

The MAE and MAPE are really decent enough:

Train MAPE: 3.3%, Val MAPE: 4.9%

The train data and validation data graph also looks decent enough, the blue line represents actual values for training data and orange line represents predicted values on train data. The green line represents actual values for validation data and red line represents predicted values:

enter image description here

However, my:

Train R2: 0.63, Val R2: -0.37

I have searched across many resources, asked Google Gemini ChatGPT, got similar responses but I am still not able to figure out why my R2 is coming out to be so weird when everything else seems to be decent. Can we use this model to implement or infer in real-world?

Please note: I have also tried Random Forest, LightGBM, XGBoost and many other linear and bagging/boosting models, results are almost similar. Graph looks ok, MAE, MAPE looks good but R2 is not in normal range.

$\endgroup$
9
  • $\begingroup$ How many variables do you have ? As a starting point, could you show us a simple linear model with the same variables/features as the model that produced that plot, using ‘lm’ if using R, or ‘OLS’ if using Python/statsmodels. Just edit the question and add the summary output of the model. $\endgroup$ Commented Dec 2 at 12:48
  • $\begingroup$ I have around 160 rows and 15-20 feature columns shortlisted from 40-45 columns using RFECV $\endgroup$ Commented Dec 2 at 18:42
  • $\begingroup$ The MAE and MAPE are really decent enough How do you assess that to be true? $\endgroup$
    – Dave
    Commented Dec 2 at 18:44
  • $\begingroup$ I am getting a MAPE of 0.02 on training data and 0.04 on validation data. MAE is 25 on train and 45 on validation. Also, going by the definition of R2, don't you think the graph is not justified for such a high negative R2 $\endgroup$ Commented Dec 2 at 20:02
  • $\begingroup$ But how do you assess those to be good values? $\endgroup$
    – Dave
    Commented Dec 2 at 20:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.