It's easy
Implementing recommenders in MyMediaLite is very easy. All infrastructure is already in place, you can concentrate on the algorithm.
For the basic functionality, all you need to is:
- derive from
RatingPredictor
orItemRecommender
- define the model data structures
- write the
Train()
method - write the
Predict()
method
That's all! Here is an example for implementing a rating predictor.
You can read the complete source code of the SlopeOne
class
in MyMediaLite's git repository.
Inherit from RatingPredictor
, Define Model Data Structures
By inheriting from the RatingPredictor
class,
you get the complete infrastructure that your new recommender will need,
most notably the Ratings
data.
Slope One needs two matrices, one for storing the mean rating difference between two items,
and one for storing the number of item pairs the average is based on.
The average rating is used as a fallback.
Implement the Train()
Method
Implement the Predict()
Method