Quantcast

Content-based Recommender Implementation

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Content-based Recommender Implementation

samsam
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Content-based Recommender Implementation

Sean Owen
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 <[hidden email]> 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.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Content-based Recommender Implementation

Gökhan Çapan
Sean, may the following approach be useful?
You can create item vectors whose dimensions are content attributes, and use
the framework as if you are implementing a recommender.

your data may be structured as
*item_id, content_feature_id*

instead of
*user_id, item_id*

and you can find similar items in terms of content features using a
Recommender

On Tue, Jun 22, 2010 at 3:11 PM, Sean Owen <[hidden email]> wrote:

> 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 <[hidden email]> 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.
> >
>



--
Gökhan Çapan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Content-based Recommender Implementation

Sean Owen
So "users" are items and "items" are item-features? Sure, you can do
that. I don't think you need a full recommender though. That would
recommend new features to items or something. Instead, with the input,
you can use standard collaborative filtering similarity metrics to
determine some notion of item-item similarity.

And then return to your real users and items, with that item-item
similarity, and proceed to recommend.

Sure that's a fine idea.

On Tue, Jun 22, 2010 at 1:39 PM, Gökhan Çapan <[hidden email]> wrote:

> Sean, may the following approach be useful?
> You can create item vectors whose dimensions are content attributes, and use
> the framework as if you are implementing a recommender.
>
> your data may be structured as
> *item_id, content_feature_id*
>
> instead of
> *user_id, item_id*
>
> and you can find similar items in terms of content features using a
> Recommender
>
> On Tue, Jun 22, 2010 at 3:11 PM, Sean Owen <[hidden email]> wrote:
>
>> 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 <[hidden email]> 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.
>> >
>>
>
>
>
> --
> Gökhan Çapan
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Content-based Recommender Implementation

Gökhan Çapan
On Tue, Jun 22, 2010 at 3:43 PM, Sean Owen <[hidden email]> wrote:

> So "users" are items and "items" are item-features? Sure, you can do
> that. I don't think you need a full recommender though. That would
> recommend new features to items or something. Instead, with the input,
> you can use standard collaborative filtering similarity metrics to
> determine some notion of item-item similarity.
>

Yes.


> And then return to your real users and items, with that item-item
> similarity, and proceed to recommend.
>
>
One can discover content based item-to-item similarities from that model,
find most similar items to the items that target user's history contains,
aggregate results and return, to recommend items to a user based on content.


> Sure that's a fine idea.
>
> On Tue, Jun 22, 2010 at 1:39 PM, Gökhan Çapan <[hidden email]> wrote:
> > Sean, may the following approach be useful?
> > You can create item vectors whose dimensions are content attributes, and
> use
> > the framework as if you are implementing a recommender.
> >
> > your data may be structured as
> > *item_id, content_feature_id*
> >
> > instead of
> > *user_id, item_id*
> >
> > and you can find similar items in terms of content features using a
> > Recommender
> >
> > On Tue, Jun 22, 2010 at 3:11 PM, Sean Owen <[hidden email]> wrote:
> >
> >> 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 <[hidden email]> 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.
> >> >
> >>
> >
> >
> >
> > --
> > Gökhan Çapan
> >
>



--
Gökhan Çapan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Content-based Recommender Implementation

Ted Dunning
In reply to this post by Sean Owen
You can also recommend attributes to users by reducing the user, item
history file to a user, attribute history file.  Once you have recommended
attributes, you can use a search engine or an attribute to item
recommendation engine to get the items to recommend.

On Tue, Jun 22, 2010 at 5:43 AM, Sean Owen <[hidden email]> wrote:

> So "users" are items and "items" are item-features? Sure, you can do
> that. I don't think you need a full recommender though. That would
> recommend new features to items or something. Instead, with the input,
> you can use standard collaborative filtering similarity metrics to
> determine some notion of item-item similarity.
>
> And then return to your real users and items, with that item-item
> similarity, and proceed to recommend.
>
> Sure that's a fine idea.
>
> On Tue, Jun 22, 2010 at 1:39 PM, Gökhan Çapan <[hidden email]> wrote:
> > Sean, may the following approach be useful?
> > You can create item vectors whose dimensions are content attributes, and
> use
> > the framework as if you are implementing a recommender.
> >
> > your data may be structured as
> > *item_id, content_feature_id*
> >
> > instead of
> > *user_id, item_id*
> >
> > and you can find similar items in terms of content features using a
> > Recommender
> >
> > On Tue, Jun 22, 2010 at 3:11 PM, Sean Owen <[hidden email]> wrote:
> >
> >> 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 <[hidden email]> 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.
> >> >
> >>
> >
> >
> >
> > --
> > Gökhan Çapan
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Content-based Recommender Implementation

anilkumar
This post has NOT been accepted by the mailing list yet.
In reply to this post by Sean Owen
Hi Sean Owen,

can u walk us through full coding samples what you explained.

I have gone through below paper but i don't know how to implement it in mahout.

http://infolab.stanford.edu/~ullman/mmds/ch9.pdf

 It would be very useful to us, i am new to this content based recommedations.

Thanks,


Loading...