Online Collaborative Filtering

Contents

Overview.

Usage.

Convert.

MovieLensConverter converter = new MovieLensConverter();
converter.convert(pathToPreferences, pathToMovieGenres, convertedOutputPath);

Configuration and Train.

OnlineCF recommender = new OnlineCF(); 
recommender.setInputPreferences(convertedOutputPath); 
recommender.setIteration(150); 
recommender.setMatrixRank(3); 
recommender.setSkipCount(1); // after how many steps we should synchronize values in each task 
recommender.setUpdateFunction(MeanAbsError.class); 
recommender.setOutputPath(outputFileName); 
recommender.train();

Load.

recommender.load(pathToTrainedModel, false);

Predict.

// estimate score 
double estimatedScore = recommender.estimatePreference(userId, itemId);

// estimate user similarities
double userSimilarity = recommender.calculateUserSimilarity(user1, user2); 
// Pair<K, V> - where K predicted similar user, V predicted similarity score 
List<Pair<Long, Double>> similarUsers = recommender.getMostSimilarUsers(userId, count);

// estimate item similarities 
double itemSimilarity = recommender.calculateItemSimilarity(item1, item2); 
// Pair<K, V> - where K predicted similar item, V predicted similarity score 
List<Pair<Long, Double>> similarItems = recommender.getMostSimilarItems(itemId, count);

Complementary functions

References

OnlineCF (last edited 2014-02-12 16:35:15 by MartinIllecker)