Skip to Content
Machine Learning: End-to-End guide for Java developers
book

Machine Learning: End-to-End guide for Java developers

by Richard M. Reese, Jennifer L. Reese, Boštjan Kaluža, Dr. Uday Kamath, Krishna Choppella
October 2017
Intermediate to advanced
1159 pages
26h 10m
English
Packt Publishing
Content preview from Machine Learning: End-to-End guide for Java developers

Content-based filtering

Content-based filtering is out of scope in the Mahout framework, mainly because it is up to you to decide how to define similar items. If we want to do a content-based item-item similarity, we need to implement our own ItemSimilarity. For instance, in our book's dataset, we might want to make up the following rule for book similarity:

  • If genres are the same, add 0.15 to similarity
  • If author is the same, add 0.50 to similarity

We could now implement our own similarity measure as follows:

class MyItemSimilarity implements ItemSimilarity { ... public double itemSimilarity(long itemID1, long itemID2) { MyBook book1 = lookupMyBook (itemID1); MyBook book2 = lookupMyBook (itemID2); double similarity = 0.0; if (book1.getGenre().equals(book2.getGenre()) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

DevOps Tools for Java Developers

DevOps Tools for Java Developers

Stephen Chin, Melissa McKay, Ixchel Ruiz, Baruch Sadogursky

Publisher Resources

ISBN: 9781788622219Supplemental Content