Basic idea
Suppose we have three mice, Alex, Becky and Carol. They all love cheese, but different kinds. Alex likes Spanish cheese and Italian cheese. Becky also likes Spanish and Italian cheese, but she likes Swiss too. Carol, on the other hand, hates Spanish and Italian cheese, but loves Cheddar cheese. Now, suppose we also learn Alex hates French cheese, can we guess what Becky and Carol would say about French cheese?
First, based on the fact that both Alex and Becky like Spanish and Italian cheese, we can infer that Alex and Becky have similar tastes. For the same reason, we can infer that Alex and Carol have quite opposite tastes. Then, since we know Alex hates French cheese, we can reasonably guess that Becky hates French cheese too because of the similar tastes, whereas Carol probably likes French cheese due to their opposite tastes.
That is the basic idea of recommender systems. It can be used in many applications too. For an online store, we can think of the customers as the mice in the mouse-cheese analogy, and the products as cheese, then we can generate products recommendations for customers. For a taxonomy system, we can think of the nodes to be tagged as the mice, and the tags as the cheese, then we can generate similarity scores for the nodes from the nodes-tags relationship, and we can also recommend terms for other nodes.
The Recommender API module provides a set of APIs to calculate similarities among the mice, and then predict how each mouse would evaluate each cheese based on the evaluation from other mice, and finally generate a list of recommended cheese to each mouse. To use the APIs, you just need to have the mouse-cheese relationship stored in a table, and then select the right algorithm to do the calculation. Different algorithms will be explained below.
Algorithms
Classical
This is the classical family of collaborative filtering algorithms based on correlation coefficients. The most famous examples include the User-User algorithm, and the Item-Item algorithm. If you are not sure which algorithm to use, just use this one because it performs well in most cases, and is widely used in many applications.
More readings:
- Resnick, P., Iacovou, N., Sushak, M., Bergstrom, P., & Riedl, J. (1994). GroupLens: An open architecture for collaborative filtering of netnews. Paper presented at the Proceedings of the 1994 Computer Supported Collaborative Work Conference.
- Linden, G., Smith, B., & York, J. (2003). Amazon.com recommendations: item-to-item collaborative filtering. Internet Computing, IEEE, 7(1), 76-80.
Slope-One
This algorithm has much better performance. In some cases, it generates better results too (see the reading below). But it's not widely studied in the academia or widely appied to many real world practices. Another drawback is that it cannot compute similarities among the mice, but can only predict mouse-cheese scores.
More readings:
- http://en.wikipedia.org/wiki/Slope_One
- Lemire, D., & Maclachlan, A. (2005). Slope One Predictors for Online Rating-Based Collaborative Filtering. Paper presented at the SIAM Data Mining (SDM'05).
Co-ocurrences
This is a very simple and high performance algorithm. It only calculates similarities among the mice by how many cheese they share. For example, if mouse A and mouse B like 4 types of cheese in common, then the similarity score between A and B would be 4. This is the algorithm used in the "Similar By Terms" module. However, this algorithm has one major drawback -- suppose a mouse simply loves all cheese, then that mouse would have the highest similarity score with all other mice, which is obviously not correct.
PageRank
To be developed. More readings: http://en.wikipedia.org/wiki/PageRank
SVD
To be developed. More readings: http://en.wikipedia.org/wiki/Singular_value_decomposition
PCA
To be developed. More readings: http://en.wikipedia.org/wiki/Principal_components_analysis
Influence Limiter
To be developed. This algorithm is supposed to prevent manipulation of the recommender system. More readings:
- Resnick, P., & Sami, R. (2007). The influence limiter: provably manipulation-resistant recommender systems. Paper presented at the Proceedings of the 2007 ACM conference on Recommender systems.
Comparison of algorithms
| Similarity | Prediction | Incremental update | In-memory calculation | Missing data auto append | 0-1 Weight field | Performance | Accuracy | |
|---|---|---|---|---|---|---|---|---|
| Classical | X | X | Partial | X | X | poor | high | |
| Slope-one | X | medium | medium | |||||
| Coocurrence | X | X | X | high | poor | |||
| PageRank (TBD) | ||||||||
| SVD (TBD) | ||||||||
| PCA (TBD) | ||||||||
| Inflence Limiter (TBD) |
- Similarity: whether it supports calculation of similarity scores among the mice.
- Prediction: whether it upports calculation of predictions scores for the mouse-cheese pair.
- Incremental update: whether it supports incremental update, or each time it rebuilds the whole index again
- In-memory calculation: whether it supports in-memory calculation (usually it's in database calculation)
- Missing data auto append: When a mouse doesn't rate a cheese, by default we treat it as missing data. However, we can ask the algorithm to automatically treat the missing data as 0.
- 0-1 weight field: whether the "weight" field of the mouse-cheese pair can be only 0s and 1s.
- Performance: whether it is computation intensive.
- Accuracy: whether the result has a high quality.
How to use the APIs
The APIs usually require these parameters:
- $app_name: The name of your application that calls the API. This is used to identify different applications that uses Recommender API.
- $table_name: The name of the table that saves the mouse-cheese rating. Recommender API will do all the calculations based on the mouse-cheese relationships stored in the table.
- $field_mouse: The field of the mouse_id in $table_name to identify different mice.
- $field_cheese: The field of the cheese_id in $table_name to identify different cheese.
- $field_weight: The field of mouse-cheese rating, or weight, in $table_name. It signifies how strong is the relationship between a mouse and a cheese.
- $options: This is an array of options passed to the API, for example, whether to use the 'basic' or 'weighted' extensions of SlopeOne algorithm.
To use the APIs, you need to have the mouse-cheese table that stores records like "Mouse A rated Cheese X as 5", or "Mouse B dislikes Cheese Y". That table might be part of an existing table. In that case, you might want to create a view from the existing table, or create a table and insert mouse-cheese records into that table. Then pass the view name or table name as $table_name to the APIs.
Also, please be noted that the calculation might take a long time
to finish due to the complexity nature of the task. The calling function
should provide a user-friendly interface such as a progress bar. Also,
you might want to consider providing a drush or drupal.sh interface
to do the calculation offline.
In the recommender.module file, functions like
recommender_similarity_*() are to calculate similarity scores for the
mice. Functions like recommender_prediction_*() are to calculate
prediction scores for the mice-cheese pairs. Functions starts with the
underscore are private functions, not public APIs, and are subject to
change. Other functions are helper functions. Please refer to the comments in recommender.module for more
details. You can also look at the code of the User-to-user Recommendation
module as an example of how to use the APIs. For support or other questions, please submit your request to the
issue queue. Thanks.

Comments
nfl jerseys on sale
Fri, 12/25/2009 - 00:17 — nfl jerseys on sale (not verified)we wholesale nfl jerseys.
cheap nfl jerseys
nfl jerseys on sale
New Orleans Saints jerseys
great job
wholesale replica handbags
Sat, 12/19/2009 - 01:46 — wholesale replica handbags (not verified)Replica Louis vuitton handbags
designer replica bags
wholesale replica handbags
louis
Wed, 12/09/2009 - 22:41 — Anonymous (not verified)louis vuitton
[url=http://www.flashreplica.com]louis vuitton[/url]
TV Shows Watch American Idol
Mon, 12/07/2009 - 09:04 — Anonymous (not verified)TV Shows
Watch American Idol Online Live
Watch Fringe Online Live Free
Watch NBC online live for free
Watch ESPN online live for free
Watch CBS TV online live free
Watch CW TV online live free
Watch CSI online live free
Watch ESPN NFL online live free
Watch House MD online live free
Cheap Fossil Watches Online
Mon, 12/07/2009 - 09:03 — Anonymous (not verified)Cheap Fossil Watches Online
louis
Sun, 12/06/2009 - 09:05 — Anonymous (not verified)louis vuitton
[url=http://www.flashreplica.com]louis vuitton[/url]
I really liked the blog and
Wed, 11/25/2009 - 19:21 — vijay (not verified)I really liked the blog and the topic is really amazing..I don't have words to express my feelings...cigar store
Dior Handbags
Tue, 11/24/2009 - 22:22 — Dior Handbags (not verified)Python bag,
Lizard Handbag
Designer purses,
fashion bag,
alligator;handbags,
ugg boots
Fri, 11/20/2009 - 23:59 — ugg boots (not verified)UGG Boots uk | ClassicUGG Boots sale-To ensure your toes are in heaven,UGG Boots made by UGG Australia are your must-have boots.50-70% off.Love UGGs.
UGG Bailey Button boots
Classic Tall UGG Boots
top quality watches
Tue, 11/10/2009 - 01:42 — Swiss replica (not verified)Welcome to our website,http://www.progiftstore.com, we are professional watch maker who can provide you with a variety of replica watches, these replica watches are high quality and are sold at a cheap price.
This article had some real
Sun, 11/01/2009 - 22:57 — Anonymous (not verified)This article had some real helpful bits in it, thanks. Waybuloo Toys Timmy Time Toys Wotwots Toys Numberjacks Toys Leapster
We all know that really,
Fri, 10/30/2009 - 12:04 — Gotomeeting Review (not verified)We all know that really, Promo Code concepts of late are due to the spread of the gay.com promo code. This is puzzling, seeing as pc pitstop promo code is far less widespread than the inkgrabber promo code can claim to be.
DGD
Thu, 10/22/2009 - 02:28 — replica handbags (not verified)fake replica handbags
fake replicas handbags
fake wholesale replica handbags
fake designer replica handbags
fake replica designer handbags
fake fake designer handbags
fake replica handbags wholesale
http://www.flashreplica.com
Sat, 10/17/2009 - 23:25 — LV (not verified)louis vuitton
[url=http://www.flashreplica.com]louis vuitton[/url]
You know what! Women's
Mon, 10/12/2009 - 04:38 — tiffany jewelry (not verified)You know what! Women's jewelry box is bottomless, just like women's desire for new jewelries. tiffany jewelry Have you ever pay attention to your constellation when choosing jewelry? Many of you may never do that, but actually the right jewels that are matched well with your constellation will bless and highlight you in some way. tiffany jewelry That is because as an indispensable decoration of clothes, jewelries are so important that they could display and highlight one's special qualities tiffany jewelry. tiffany bracelet It is a pity that the majority of people are at the end of the wits in choosing jewels. tiffany rings Hopefully, the tips presented herein on matching jewelries will be of assistance. tiffany charms The basic principle is to make the jewels that you chose are fit for your complexion, age, dresses, occasions and so on. tiffany mesh ring The most important code: on one hand, your jewels can't be the same shape with your face; on the other hand, they can't be extremely different from your face shape. tiffany jewelry The best jewel piece for a girl with a heart-shape face is the one that is wider at the bottom because once again that will balance out that chin. And something likes a teardrop tiffany jewelry, upside down triangle, or even a button look perfect. tiffany jewelry If you wear an Afro hairstyle, then the loud and large earrings are the best choice. silver tiffany jewelry Jeans and jackets matched with rough and wild tiffany will have a different taste - a unique sense of modernness. tiffany jewelry If you wear some proper tiffany jewelry jewels when visiting your relatives and friends, your personal taste will be displayed. tiffany jewelry But it is more suitable for ladies with fair skin to wear jewels with red or other dark color jewels which will pick up the complexion. tiffany jewelry While the tall and plump ladies can choose the ones in large size but not the small ones which will let them look mean. tiffany jewelry The suit matched with neat and simply tiffany jewelry will let these office ladies look very charming and elegant. tiffany jewelry
nike dunks
Tue, 10/06/2009 - 21:22 — nike dunks (not verified)in the market shoes design is all kinds, ugg boots and classic ugg boots were the riotous multi-colors, each kinds of color and design are finitely looks like the young women''s hairstyle , every day them use the ghd Straighteners to changes themself hairstyle.Please pay attention to the ghd Hair Straighteners site .
More and more people like to wear dunks sb basketball shoes.nike sb dunks-Strong grips,durable ankle support and very comfort.Nike dunks are the most desirable skate shoes.Get your Nike Dunk SB Now!Free shipping.
uggs bailey button
ugg boots uk
eople to enjoy music, a need for a high-quality sound equipment to show the moving melody to enhance the music quality of life,It is the use of Bose in ear headphones and Bose on ear headphones.
insurance quotes
Sat, 10/03/2009 - 10:58 — Anonymous (not verified)insurance quotes
Nice site for API
Tue, 09/08/2009 - 14:32 — Ashish T (not verified)Thanks for this API page.
When will the pagerank script be available ?
regards,
ASHISH THAKKAR
Scripts and source code
Wanna to share a nice replica
Mon, 09/14/2009 - 21:32 — replica watches (not verified)Wanna to share a nice replica Watches webiste that I shop my favourite replica Watch, price are so low,and the service,wonderful!
Do you have any suggesting to
Sun, 08/23/2009 - 11:10 — Anonymous (not verified)Do you have any suggesting to process a very large database?
Q_nana
Tue, 08/18/2009 - 03:40 — Q_nana (not verified)手 汗
育毛剤
leather
お見合い
受託開発
電話占い
seoツール
カード決済
価格 マウス
プリンタ 価格
パソコン 価格
格安 カーナビ
市川市 不動産
アルカリイオン水
保土ヶ谷 不動産
江戸川区 不動産
川崎市幸区 不動産
ノート パソコン 価
自動車教習所 東京
ウォーター サーバー
日本ITブログポータルサイト
thanks
Mon, 08/10/2009 - 03:45 — the1design.cn (not verified)it is a seo useful modules,thanks!
Status of Recommender API?
Thu, 08/06/2009 - 19:35 — Matt (not verified)Hi there Daniel,
Just curious how things are going with the Recommender API? Is there a place where you're blogging about your progress?
I'm specifically interested in the Similar by Terms work you'll be doing (integrating with the Recommender API, I assume). Just wanted to track how it's coming along.
Thanks!
I am very interested in
Tue, 03/31/2009 - 06:20 — Kredyty (not verified)I am very interested in subject of this site. I want to say thanks to the author.
! THANKS ! And here is mine interesting site: kredyt samochodowy.
Best regards!
Post new comment