October 2017
Intermediate to advanced
1159 pages
26h 10m
English
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:
0.15 to similarity0.50 to similarityWe 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()) ...