User-to-User Recommenders
User-to-User Recommenders
If two users have similar preferences, they are likely to like the same items. Gorse has implemented user-to-user recommenders that support similarity based on labels or favorite items.
Configuration
The user-to-user recommenders need to be explicitly configured. The following three fields need to be filled in:
nameis the name of the recommender.typeis the similarity type, and the following values are supported:embeddingis the Euclidean distance between embedding vectors.tagsis the similarity based on the number of common labels.itemsis the similarity based on the number of common favorite items.
columnis the field used by the recommender to calculate the similarity, expressed in the Expr language.
Algorithms
Embedding Similarity
There are -dimensional embedding vectors and for two items respectively, the embedding similarity between them is
Tags Similarity
First, we use IDF to calculate the weight of each tag. The tag weight is defined as
If a tag is used by more users, this tag is more generic and has a lower weight. Then, calculates similarity based on label overlap between users
Items Similarity
First, we use IDF to calculate the weight of each item.
- Item weight: The item weight is defined as
If an item has more users, it means that this item is popular but has a lower weight to characterize users' preferences. Then, calculates similarity based on item overlap between users.
Recommendation
The user-to-user recommender first finds similar users for the target user, then sums up items from positive feedback of similar users, and finally ranks items by similarity scores to get the final recommendation score:
where represents the set of similar users of user , represents the similarity between user and user , and is an indicator function that equals 1 if item is in the positive feedback set of user .
API
You can access similar users through the following API:
curl http://localhost:8087/api/user-to-user/<name>/<user-id>Examples
For example, to recommend items based on similar users calculated from favorite items, the configuration is as follows:
[recommend.user_neighbors]
name = "similar_users"
type = "items"