# Overfitting in recommender systems

So I want to know whether or not my models are overfitting or the difference between train and validation errors are decent.

$$L$$: is the number of neighbors

The first column is the train error

The second column is the validation error

Okay. Actually I got those values from 5-fold cross validation. So the column error on the right is the averaged test error over all folds and the errors on the column on the left are the averaged train error over all folds. From what i know you are supposed to know if a model is overfitting or not by adding more data to the training set? In this example all I did was to sweep the values of the $$L$$ neighbors.

• What metric exactly are we looking at here? – user2974951 Sep 9 at 7:22
• We are looking at RMSE – Delan Sep 9 at 7:29
• There is something weird going on, since the validation error remains pretty much constant throughout the L's while the training error actually increases. If you were overfitting you would expect this to decrease not increase. – user2974951 Sep 9 at 7:35
• Okay. Actually I got those values from 5-fold cross validation. So the column error on the right is the averaged test error over all folds and the errors on the column on the left are the averaged train error over all folds. From what i know you are supposed to know if a model is overfitting or not by adding more data to the training set? In this example all I did was to sweep the values of the L neighbors. – Delan Sep 9 at 7:39
• Still, the results are telling you that you are getting worse results on your training set if you increase L, while the validation results tell you that you are not really learning anything new if you increase L, you are getting very similar results across the L's. – user2974951 Sep 9 at 7:42

But in the case of k-nearest neighbors (as I assume you're doing), increasing the number of neighbors ($$L$$) would actually lead to underfitting (see here: Does k-NN with k=1 always implies overfitting?)
So this is why I suggested lowering $$L$$. You should see train error go down, and test error go (generally) up. You could then decide what your $$L$$ should be, based on where the errors are "balanced".
Visually, you're on the left side of this graph. You need to explore further to the right (in the direction of decreasing bias) and this could be done by lowering $$L$$.