Product Hunt is the new rising star in the start-up community. Think of it as a mix of Beta List and Hacker News, but with products that are already live, and a wider community, including engineers of course, but also product people, investors, media and more. A few days ago, and by popular demand, they’ve launched early access to heir official API.
— Ryan Hoover (@rrhoover) August 17, 2014
More Products: A Chrome plug-in for Product Hunt recommendations
With more than 6,000 products already in the Product Hunt database, I’ve decided to use the API to build a product recommendation engine. It seems that evey times it comes to hacking and APIs, I can’t get away of discovery, or music. Or both.
The result is a Chrome extension simply named “More Products!”. It directly integrates top-10 related products for each product page, as you can see below. I might iterate on the algorithm itself, but want to keep this plug-in very focused so it’s unlikely that it will integrate other features. Note that it doesn’t track anything, so your privacy is preserved.
Under the hood
The engine relies on the API to get the list of all products and related posts, and then uses TF-IDF and Cosine similarity to to find similarities between them, using NLTK and scikit-learn, respectively the standard Python tools for Natural Language Processing and Machine Learning. To put it simply, it builds a giant database of words used in all posts, mapped to products with their frequency, and then finds how close products are, based on those frequencies.
New products are fetched every 2 hours, and recommendations are updated at the same time. Flask handles requests between the extension and the recommendations database, and Redis is used as a cache layer.