A Java Implementation of Latent Factor Models for Recommender Systems
This is a Java implementation of a user/item bias baseline model, and
three basic latent factor models (LFMs) for rating prediction
in recommender systems.
- Implementation of the four models strictly follows the description in Koren and Bell's
Advances in collaborative filtering chapter.
Stochastic gradient descent (SGD) is used to optimize the objective function.
- Our goal is to keep the code as simple as possible, and thus have removed any non-essential functionality,
such as input checking and model loading.
- Due to the simplicity of the code, it should be very flexible to develop and test new models.
Please find the latest source here lfm.zip. Below is a brief introduction to the contained files.
- Util.java
- - Common functions: data input, vector computation, RMSE calculation and etc.
- Rec.java
- - An interface to be implemented by all the models.
- RecBaseline.java
- - Baseline model:
- RecMF.java
- - Pure factor model:
- RecMuMF.java
- - A mixed model:
- RecSVD.java
- - SVD model: .
Here is an example to run "SVD"
on the Movielens 1M dataset.
- Unzip lfm.zip
- Open "RecSVD.java" and check the training and test files in the main function
- javac *.java
- java RecSVD
We are always happy to receive feedback. Please notify us of any bugs by sending email to
thomo@cs.uvic.ca
- Koren, Yehuda, and Robert Bell. "Advances in collaborative filtering." In Recommender Systems Handbook, pp. 145-186. Springer US, 2011.