Skip to content

Mahendra-Maiti/Non-personalized-recommender

Repository files navigation

Non-Personalized Recommender

In this assignment, some non-personalized recommenders are implemented. In particular, they are: raw and damped item mean recommenders, simple and advanced association rule recommenders.

Input Data

The input data contains the following files:

  • ratings.csv contains user ratings of movies
  • movies.csv contains movie titles
  • movielens.yml is a LensKit data manifest that describes the other input files

Mean-Based Recommendation

The first two recommenders recommend items with the highest average rating.

With LensKit's scorer-model-builder architecture, the recommendation logic is required to be written only once. Two different mechanisms for computing item mean ratings can be used with the same logic.

For mean-based recommendation the classes are :

  • MeanItemBasedItemRecommender (the item recommender) computes top-N recommendations based on mean ratings.

  • ItemMeanModel is a model class that stores precomputed item means.

  • ItemMeanModelProvider computes item mean ratings from rating data and constructs the model. It computes raw means with no damping.

  • DampedItemMeanModelProvider is an alternate builder for item mean models that computes damped means instead of raw means. It takes the damping term as a parameter.

Computing Item Means

The ItemMeanModelProvider class computes the mean rating for each item.

Recommending Items

The MeanItemBasedItemRecommender class computes recommendations based on item mean ratings. Recommendation is done as per the following steps:

  1. Obtain the mean rating for each item
  2. Order the items in decreasing order
  3. Return the N highest-rated items

Computing Damped Item Means

The DampedItemMeanModelProvider class is used to compute the damped mean rating for each item. This formula uses a damping factor equation, which is the number of 'fake' ratings at the global mean to assume for each item. In the Java code, this is available as the field damping.

The damped mean formula, is:

equation

where equation is the global mean rating.

Association Rules

The association rule implementation consists of the following code:

  • AssociationItemBasedItemRecommender recommends items using association rules. Unlike the mean recommenders, this recommender uses a reference item to compute the recommendations.
  • AssociationModel stores the association rule scores between pairs of items. You will not need to modify this class.
  • BasicAssociationModelProvider computes an association rule model using the basic association rule formula equation.
  • LiftAssociationModelProvider computes an association rule model using the lift formula equation.

Computing Association Scores

Like with the mean-based recommender, the product association scores are pre-computed and stored in a model before recommendation. The scores between all pairs of items are computed, so that the model can be used to score any item. When computing a single recommendation from the command line, this does not provide much benefit, but is useful in the general case so that the model can be used to very quickly compute many recommendations.

The BasicAssociationModelProvider class computes the association rule scores using the following formula:

equation

In this case, equation is the reference item and equation is the item to be scored.

The probabilities are estimated by counting: equation is the fraction of users in the system who purchased item equation;equation is the fraction that purchased both equation and equation.

Computing Recommendations

The recommendation logic in AssociationItemBasedItemRecommender is used to recommend items related to a given reference item. As with the mean recommender, it computes the top N recommendations and return them.

Computing Advanced Association Rules

The LiftAssociationModelProvider recommender uses the lift metric that computes how much more likely someone is to rate a movie equation when they have rated equation than they would have if we do not know anything about whether they have rated equation:

equation

Running the code

The following Gradle targets will do this:

  • runMean runs the raw mean recommender
  • runDampedMean runs the damped mean recommender
  • runBasicAssoc runs the basic association rule recommender
  • runLiftAssoc runs the advanced (lift-based) association rule recommender

These can be run using the IntelliJ Gradle runner (open the Gradle panel, browse the tree to find a task, and double-click it), or from the command line:

./gradlew runMean

The association rule recommenders can also take the reference item ID on the command line as a referenceItem parameter. For example:

./gradlew runLiftAssoc -PreferenceItem=1

About

A recommender system for movies using summary statistics

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published