SimpleSimilarityModel
Uses a simple function where a larger intersection of preferred items results in greater similarity
The SimpleSimilarityModel class is accessible via the consensus module.
Methods
f __init__(self, judgeRatings=None, judges=None) ...
Initialize the model with a group of judges and their rating histories
judgeRatings is a dictionary mapping judges to their rating histories. Rating histories are represented as dictionaries mapping items to their rating by that judge. If a list judges is given as a list of judges, judgeRatings will be initialized with empty rating histories.
f getNeighbors(self, judge, limit=None, threshold=None, neutralScore=0, items=None) ...
Get a sorted list of neighbors for the given judge, where neighbors are defined as judges with preferences most similar to the given judge.
judge is the user for whom a list of neighbors will be calculated.
If limit is given, it will limit the length of the list of neighbors being returned. If threshold is given, it specifies the cutoff point for which neighbors will be included. This will be highly dependent on which model is chosen. A lower threshold will result in fewer neighbors being returned.
neutralScore and items are as defined in Model.similarity .
f getRecommendations(self, judge, limit=None, neutralScore=0, items=None) ...
Return a list of items and their scores (how relevant they are to the given judge), sorted from most recommended to least recommended.
limit , neutralScore , and items are all as defined in Model.getNeighbors .
f similarity(self, j1, j2, neutralScore=0, items=None) ...
See Model.similarity for argument information.
See the source for more information.