After reading some tutorials and articles about recommender systems, I can't really figure out whether I should split the dataset into train/test sets or use the whole dataset to allow the model to memorize every users/items interactions during the training.

If I consider I can retrain the model everyday, would it make sense to let the model overfit data on the whole dataset since the model will only recommend known items for known users (when considering this use-case) ?

Moreover, when using embeddings like in two-towers models, can the embedding know how to embed a user with an unseen user id ? Is it sufficient to use user's features to embed an unseen user ?

Thanks, Jérémy


1 Answer 1


Depends on your model and your motivation.

If you are training a content-based model, then your data will consist of item/user features. In this case, you may want to separate some items/users for testing if you want your model to recommend unseen items to users. You may otherwise want to only recommend items that have been included in the whole dataset whenever you train a new model.

If you are training a collaborative model, then your data will consist of user-item interactions. In this case you may want to set aside some interactions for testing. You can either choose to take a user/item and put them in the test set with all its interactions, or you can just get some interactions and leave the users/items in the training set.

lightfm.cross_validation.random_train_test_split splits interactions randomly.

This neo4j example is a very basic tutorial and does not mention any train/test splitting.


Your Answer

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

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