1
$\begingroup$

I was tyring out a pizza price dataset. With two different approaches, the results were different (as shown in the screenshot below). As the dashed line shows, the model was overfitted. But it is clear that it actually started to overfit after the biggest available pizza size. And within the reasonable pizza size range, the dashed line fits way better than the straight line.

I've encountered this situation several times with different datasets. So I wonder that when we limit the data parameter range, does it really matter that the model overfits outside of the range?

overfit & linear regression

$\endgroup$
3
  • $\begingroup$ This seems more of a question about machine learning than programming. $\endgroup$
    – acylam
    Dec 5, 2016 at 2:44
  • $\begingroup$ @user I have proposed an edit that would delete the R and python tags. Awaiting peer review. $\endgroup$
    – G5W
    Dec 5, 2016 at 2:48
  • $\begingroup$ @G5W Thanks, but I still think that this should be asked in Cross Validated, since he did not ask how to implement this in programming. $\endgroup$
    – acylam
    Dec 5, 2016 at 5:12

1 Answer 1

1
$\begingroup$

Yes, it still matters because you are biasing your predictions based on the training data. In your graph, you can see that the model forecasts a higher value for the values in the middle and lower for the values on the end. This means, that if there is actually a linear relationship between the diameter and the price, you will see higher errors due to this bias.

If on the other hand, the relationship isn't actually linear, it may be ok to have a graph like this. If you do have a relationship between diameter and price where it increases quickly for the low values and then levels off as the diameter gets larger, you would want to capture that in the model. A logarithmic model might be a better way of doing this, but if for one reason or another that isn't a reasonable model for you to build, you might be able to approximate the behavior in the value range of interest using a quadratic model.

The important thing is to try to capture the relationship between your predictors and your outcome with the acknowledgement that generally simpler models can do that better in small data. If you know your data don't behave the way your model does, you are unlikely to get good results.

$\endgroup$

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.