mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Owen <sro...@gmail.com>
Subject Re: Content-based Recommender Implementation
Date Tue, 22 Jun 2010 12:11:16 GMT
This is the part that is more up to you, and outside the framework.

Let's say you have movies as items. Let's say you want to use their
genre and director (content, attributes) to define some idea of
similarity. Maybe you make up the following rule:

if genres are the same, add 0.1 to similarity
if directors are the same, add 0.5 to similarity

You could easily write code something like this to implement this
notion of item-item similarity. (This is not a 100% complete example
but shows most of what you need.)

class MyItemSimilarity implements ItemSimilarity {
  ...
  public double itemSimilarity(long itemID1, long itemID2) {
    MyMovie movie1 = lookupMyMovie(itemID1);
    MyMovie movie2 = lookupMyMovie(itemID2);
    double similarity = 0.0;
    if (movie1.getGenre().equals(movie2.getGenre()) {
      similarity += 0.1;
    }
    if (movie1.getDirector().equals(movie2.getDirector())) {
      similarity += 0.5;
    }
    return similarity;
  }
  ...
}


And that's about it. You then use this ItemSimilarity instead of
something like LogLikelihoodSimilarity or other implementations with a
GenericItemBasedRecommender.
There you go, this is as far as you have to go to do content-based
recommendation in the framework.

Because the hooks are pretty easy to use, and the logic above is so
domain-specific, that's a pretty good "bright line" between CF and
content-based recommendation that the framework itself doesn't cross.

Well, this is at least one form of content-based recommendation.





On Mon, Jun 21, 2010 at 2:08 PM, samsam <yanguango@gmail.com> wrote:
> I know mahout have not supported content-based recommender,but I want to
> recommend with item's specific attributes,so who can introduce the
> implemention of content-based recommender? The book <mahout in action>
> mentions that it can be implemented base on item-based recommender,but I
> don't know how to do it specifically.
>
> And someone metioned that I should compute item-item similarities based on
> their attributes first,and how to compute it?
>
> --
> I'm samsam.
>

Mime
View raw message