Fork me on GitHub

MyMediaLite: Item recommendation files

News

MyMediaLite 3.11 has been released.


Item recommendation files

Files containing item recommendations contain the recommended items for one user in one line.

An entry line contains the user ID followed by a tab character, followed by the top N recommended items with their score.

Example

0    [9:3.5,7:3.4,3:3.1]
means that we recommend the items 9, 7, and 3 to user 0, and that their respective scores are 3.5, 3.4, and 3.1.

Command-line tools

Item recommendation

The item recommendation tool supports this file format. Use --prediction-file=FILE to specify the file name and --predict-items-number=N to specify the number of items to recommend to each user.

Classes

Reading

There is currently no class for reading this kind of file in MyMediaLite. Given the information here it should be easy to implement.

Writing

Writing item recommendations to a stream or file can be performed using the extension methods defined in MyMediaLite.ItemRecommendation.Extensions

All you need to do is to import the MyMediaLite.ItemRecommendation namespace via the using statement. Then writing out predictions is simple:

using MyMediaLite.ItemRecommendation;

...

recommender.WritePredictions(training_data, candidate_items, predict_items_number, prediction_file);

If you only want predictions for specific users, provide a list of user IDs to the method:

recommender.WritePredictions(training_data, candidate_items, predict_items_number, prediction_file, user_list);

If you mapped the user and item IDs to internal IDs, supply the mapping data as arguments to the method so that the internal IDs can be turned into their original counterparts again:

recommender.WritePredictions(training_data, candidate_items, predict_items_number, prediction_file, user_list, user_mapping, item_mapping);

ContactFollow us on Twitter