0
$\begingroup$

I'm new to machine learning, I have been doing a multiple linear regression (with 3 features,1 target). I'm using train_test_split module from sklearn to split the data into training and test data. Each time when I run the model I get different R-square values such as 0.6, 0.7, -0.122, 0.2, 0.9. How can I interpret this varying R-square value for the multiple linear regression? Is this behavior suggesting me to go for a non-linear regression?

Thanks in advance

$\endgroup$
  • 1
    $\begingroup$ You are doing something wrong. First $R^2$ can't be negative. Second, while there could be some variation in it on re-runs of the model, what you post is not reasonable. But we'd need to know a lot more to be able to tell what you are doing wrong. It could be your N is too small, it could be an error in the code, it could be a problem in how you are splitting the data, and I'm sure there are other posssibilities. $\endgroup$ – Peter Flom - Reinstate Monica Jul 15 '18 at 16:57
  • $\begingroup$ My data set is too small it contains only 18 rows, Training data size is 14 and test data size is 4. $\endgroup$ – PreeJackie Jul 15 '18 at 17:05
1
$\begingroup$

Per your comment, your whole data set is 18 and you've split it into 14 for training and 4 for test.

So, in your test data, you have 4 cases and 3 variables. That's way way overfit. Even if you split it into 9 and 9, you can only sensibly look at one independent variable with so little data.

You need either a much simpler model or a lot more data.

$\endgroup$
  • $\begingroup$ What do you mean by a simpler method? Could you please provide me an example. Adding that my residual plot showing a trend or structure when splitting the data 50% for train and 50% for a test. Whether this a indication to go for a non-linear model $\endgroup$ – PreeJackie Jul 15 '18 at 17:30
  • 1
    $\begingroup$ A simpler model - that is, one with fewer independent variables. In fact, you only have enough data for one independent variable. $\endgroup$ – Peter Flom - Reinstate Monica Jul 16 '18 at 11:14

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.