Scaling API-first – The story of a global engineering organization
Rest api to integrate with your site
1. Motivation
• Business: Selling products, movies, papers
• Research: Baseline for improvements.
• Personal uses:
• Recommend a song from your own music library
2. Input and Outputs
• Two relations: User and Products
• Input: User actions
• Buy
• View
• Rate
• Can there be any other actions?
• Output: Product suggestions
• Other users also viewed/bought/rated good.
• What are the best products for this user?
• Search engine analogy.
4. Easyrec: Open Source Recommender Engine
• http://www.easyrec.org/
• Can be used in two ways:
• Download a copy and run in localhost.
• Use the easyrec server.
• Use the REST API to integrate with your site.
• API pros and cons:
• Don’t need to bother about computation power.
• Very easy for prototyping.
• Data privacy (if you are running on easyrec server).
• Not flexible enough for fine grained customization.
5. API: Getting Started
• Create an user account, get a token.
• Create a “tenant id”: url for your website/your home
computer/anything.
• “tenant-id” and token combined work as a primary key.
• Any call to the easyrec must contain these two parameters.
6. API: Input Your Data
• Input options:
• View: The user has viewed this item.
• Buy: The user has bought this item.
• Rate: The user has rated this item.
• You can also define your own “action”
• Sample API calls:
• http://easyrec.sourceforge.net/wiki/index.php?title=REST_API_v0.98
7. API: Get Recommendations
• Other users also viewed:
• Parameter: item id.
• Other users also bought:
• Parameter: item id.
• Items rated good by other users:
• Parameter: item id.
• Users who bought this item rated these items good.
• Recommendations for user:
• Parameter: user id.
8. API: Rules, Clustering and Community Ranking
• Rules:
• You can write your own rules which will associate two items (users who rated
item A high, also bought item B).
• Rules can not be written between an user and an item.
• Clustering:
• You can create clusters of items (laptop/books/songs)
• You can get all items in a cluster.
• Community ranking:
• Items liked by/bought by/ rated by most users.
9. Conclusion
• An open source recommender system which can be readily deployed
in a small e-commerce site.
• Not much flexible:
• You might want to recommend items in a cluster based on user history on
that cluster.
• You want to develop a separate ranking function.
• Only collaborative filtering: no content based recommendation.
• Real sites have used this: http://www.flimmit.com. (See a
recommendation here. )