Search code examples
mahout

How to get k similar products using Mahout?


I have one product, let's say a book. Now I want to retrieve k products, that are similar to this product. How can I do this with Mahout?

The products are stored in a MySQL database so I'd use the JDBCDataModel. For computing the similarities I'd prefer the LogLikelihoodTest.

But which recommender should I choose? It seems that all recommenders are designed


Solution

  • I'm going to guess at the question here. You have user-item data, where users are real people and items are books. You are using LogLikelihoodSimilarity as the basis for some recommender, either user-based or item-based.

    You don't need a recommender if you just want most similar items. Just use LogLikelihoodSimilarity, which is an ItemSimilarity, to compute similarity with all other items and take the most similar ones. In fact look at the TopItems class which even does that logic for you.