You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Sam Yang <ya...@gmail.com> on 2010/09/20 17:28:41 UTC

item-based recommendation for different item

All:
When I use Item-based recommender to do recommendation for user,but for each
item,the recommendations are same.
Is there some way to return different recommendations for different item?

And,my story is when one user loggined, show recommendations on item detail
page,can these recommendations are different for each item?

-- 
I'm samsam.

Re: item-based recommendation for different item

Posted by Ted Dunning <te...@gmail.com>.
Sam,

I don't quite understand what you are saying.

Are you saying that you want different people to see different items on an
item detail page?

On Mon, Sep 20, 2010 at 8:28 AM, Sam Yang <ya...@gmail.com> wrote:

> All:
> When I use Item-based recommender to do recommendation for user,but for
> each
> item,the recommendations are same.
> Is there some way to return different recommendations for different item?
>
> And,my story is when one user loggined, show recommendations on item detail
> page,can these recommendations are different for each item?
>
> --
> I'm samsam.
>

Re: item-based recommendation for different item

Posted by Ted Dunning <te...@gmail.com>.
What you want is a recommender that is based mostly on the item with a small
admixture of the user history.  Essentially, it is a user recommendation
with a very bit weight on the current item.

On Mon, Sep 20, 2010 at 7:34 PM, Sam Yang <ya...@gmail.com> wrote:

> Here is Item-based Recommender Example:
> =====
> public class ItemBasedRecommender implements Recommender {
>
>    private final Recommender recommender;
>
>    public ItemBasedRecommender() throws IOException, TasteException {
>        this(new MovieDataModel());
>    }
>
>    public ItemBasedRecommender(DataModel dataModel) throws TasteException {
>
>        Collection<GenericItemSimilarity.ItemItemSimilarity> correlations =
>            MovieSimilarityTable.getAllMovieSimilarities();
>        ItemSimilarity itemSimilarity = new
> GenericItemSimilarity(correlations);
>        recommender = new CachingRecommender(new
> EmbededItemBasedRecommender(
>            new GenericItemBasedRecommender(dataModel, itemSimilarity)));
>    }
>
>    public List<RecommendedItem> recommend(long userID, int howMany)
>        throws TasteException {
>        return recommender.recommend(userID, howMany);
>    }
>
> .........
>
>    //EmbededItemBasedRecommender类的定义
>    private static final class EmbededItemBasedRecommender implements
> Recommender {
>
>        //包含一个GenericItemBasedRecommender实例;
>        private final GenericItemBasedRecommender recommender;
>
>        private EmbededItemBasedRecommender(GenericItemBasedRecommender
> recommender) {
>            this.recommender = recommender;
>        }
>
>        public List<RecommendedItem> recommend(long userID,  int howMany,
>            Rescorer<Long> rescorer)
>            throws TasteException {
>            FastIDSet itemIDs =
> recommender.getDataModel().getItemIDsFromUser(userID);
>            return recommender.mostSimilarItems(itemIDs.toArray(), howMany,
> null);
>        }
>
>    ........
>
> }
> ======
> The parameters of recommend method are userID and howMany,not include
> itemID,so I think for one user and every item,the recommendations are same.
>
> On Mon, Sep 20, 2010 at 11:34 PM, Sebastian Schelter <ss...@apache.org>
> wrote:
>
> > Sam,
> >
> > can you provide an example and a little more details about your data and
> > the implementations you use?
> >
> > --sebastian
> >
> > Am 20.09.2010 17:28, schrieb Sam Yang:
> > > All:
> > > When I use Item-based recommender to do recommendation for user,but for
> > each
> > > item,the recommendations are same.
> > > Is there some way to return different recommendations for different
> item?
> > >
> > > And,my story is when one user loggined, show recommendations on item
> > detail
> > > page,can these recommendations are different for each item?
> > >
> > >
> >
> >
>
>
> --
> I'm samsam.
>

Re: item-based recommendation for different item

Posted by Sam Yang <ya...@gmail.com>.
Here is Item-based Recommender Example:
=====
public class ItemBasedRecommender implements Recommender {

    private final Recommender recommender;

    public ItemBasedRecommender() throws IOException, TasteException {
        this(new MovieDataModel());
    }

    public ItemBasedRecommender(DataModel dataModel) throws TasteException {

        Collection<GenericItemSimilarity.ItemItemSimilarity> correlations =
            MovieSimilarityTable.getAllMovieSimilarities();
        ItemSimilarity itemSimilarity = new
GenericItemSimilarity(correlations);
        recommender = new CachingRecommender(new
EmbededItemBasedRecommender(
            new GenericItemBasedRecommender(dataModel, itemSimilarity)));
    }

    public List<RecommendedItem> recommend(long userID, int howMany)
        throws TasteException {
        return recommender.recommend(userID, howMany);
    }

.........

    //EmbededItemBasedRecommender类的定义
    private static final class EmbededItemBasedRecommender implements
Recommender {

        //包含一个GenericItemBasedRecommender实例;
        private final GenericItemBasedRecommender recommender;

        private EmbededItemBasedRecommender(GenericItemBasedRecommender
recommender) {
            this.recommender = recommender;
        }

        public List<RecommendedItem> recommend(long userID,  int howMany,
            Rescorer<Long> rescorer)
            throws TasteException {
            FastIDSet itemIDs =
recommender.getDataModel().getItemIDsFromUser(userID);
            return recommender.mostSimilarItems(itemIDs.toArray(), howMany,
null);
        }

    ........

}
======
The parameters of recommend method are userID and howMany,not include
itemID,so I think for one user and every item,the recommendations are same.

On Mon, Sep 20, 2010 at 11:34 PM, Sebastian Schelter <ss...@apache.org> wrote:

> Sam,
>
> can you provide an example and a little more details about your data and
> the implementations you use?
>
> --sebastian
>
> Am 20.09.2010 17:28, schrieb Sam Yang:
> > All:
> > When I use Item-based recommender to do recommendation for user,but for
> each
> > item,the recommendations are same.
> > Is there some way to return different recommendations for different item?
> >
> > And,my story is when one user loggined, show recommendations on item
> detail
> > page,can these recommendations are different for each item?
> >
> >
>
>


-- 
I'm samsam.

Re: item-based recommendation for different item

Posted by Sam Yang <ya...@gmail.com>.
Thanks,Sean,I think you are right.

On Tue, Sep 21, 2010 at 4:24 PM, Sean Owen <sr...@gmail.com> wrote:

> What you need is a IDRescorer. Use any Recommender you like, but, pass in a
> IDRescorer object too which will boost a recommended item's score if it is
> more similar to some target item. For example I might simply multiply by
> that similarity score. This should achieve your desired effect.
>
> On Tue, Sep 21, 2010 at 3:18 AM, Sam Yang <ya...@gmail.com> wrote:
>
> > Thanks,I mean,for one user,on every item detail page,see different
> > recommendations,and these recommendations are computed by the user and
> the
> > item.
> >
> > I'm recommending for users on a store,when a user login,I can compute the
> > recommendations for him with item-based recommender,these recommendations
> > will be shown on product detail page.
> > But I think the recommendations on every page will be same,so can the
> > recommendations been computed by the current product?
> >
> > On Mon, Sep 20, 2010 at 11:34 PM, Sebastian Schelter <ss...@apache.org>
> > wrote:
> >
> > > Sam,
> > >
> > > can you provide an example and a little more details about your data
> and
> > > the implementations you use?
> > >
> > > --sebastian
> > >
> > > Am 20.09.2010 17:28, schrieb Sam Yang:
> > > > All:
> > > > When I use Item-based recommender to do recommendation for user,but
> for
> > > each
> > > > item,the recommendations are same.
> > > > Is there some way to return different recommendations for different
> > item?
> > > >
> > > > And,my story is when one user loggined, show recommendations on item
> > > detail
> > > > page,can these recommendations are different for each item?
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > I'm samsam.
> >
>



-- 
I'm samsam.

Re: item-based recommendation for different item

Posted by Sean Owen <sr...@gmail.com>.
What you need is a IDRescorer. Use any Recommender you like, but, pass in a
IDRescorer object too which will boost a recommended item's score if it is
more similar to some target item. For example I might simply multiply by
that similarity score. This should achieve your desired effect.

On Tue, Sep 21, 2010 at 3:18 AM, Sam Yang <ya...@gmail.com> wrote:

> Thanks,I mean,for one user,on every item detail page,see different
> recommendations,and these recommendations are computed by the user and the
> item.
>
> I'm recommending for users on a store,when a user login,I can compute the
> recommendations for him with item-based recommender,these recommendations
> will be shown on product detail page.
> But I think the recommendations on every page will be same,so can the
> recommendations been computed by the current product?
>
> On Mon, Sep 20, 2010 at 11:34 PM, Sebastian Schelter <ss...@apache.org>
> wrote:
>
> > Sam,
> >
> > can you provide an example and a little more details about your data and
> > the implementations you use?
> >
> > --sebastian
> >
> > Am 20.09.2010 17:28, schrieb Sam Yang:
> > > All:
> > > When I use Item-based recommender to do recommendation for user,but for
> > each
> > > item,the recommendations are same.
> > > Is there some way to return different recommendations for different
> item?
> > >
> > > And,my story is when one user loggined, show recommendations on item
> > detail
> > > page,can these recommendations are different for each item?
> > >
> > >
> >
> >
>
>
> --
> I'm samsam.
>

Re: item-based recommendation for different item

Posted by Sam Yang <ya...@gmail.com>.
Thanks,I mean,for one user,on every item detail page,see different
recommendations,and these recommendations are computed by the user and the
item.

I'm recommending for users on a store,when a user login,I can compute the
recommendations for him with item-based recommender,these recommendations
will be shown on product detail page.
But I think the recommendations on every page will be same,so can the
recommendations been computed by the current product?

On Mon, Sep 20, 2010 at 11:34 PM, Sebastian Schelter <ss...@apache.org> wrote:

> Sam,
>
> can you provide an example and a little more details about your data and
> the implementations you use?
>
> --sebastian
>
> Am 20.09.2010 17:28, schrieb Sam Yang:
> > All:
> > When I use Item-based recommender to do recommendation for user,but for
> each
> > item,the recommendations are same.
> > Is there some way to return different recommendations for different item?
> >
> > And,my story is when one user loggined, show recommendations on item
> detail
> > page,can these recommendations are different for each item?
> >
> >
>
>


-- 
I'm samsam.

Re: item-based recommendation for different item

Posted by Sebastian Schelter <ss...@apache.org>.
Sam,

can you provide an example and a little more details about your data and
the implementations you use?

--sebastian

Am 20.09.2010 17:28, schrieb Sam Yang:
> All:
> When I use Item-based recommender to do recommendation for user,but for each
> item,the recommendations are same.
> Is there some way to return different recommendations for different item?
>
> And,my story is when one user loggined, show recommendations on item detail
> page,can these recommendations are different for each item?
>
>   


Re: item-based recommendation for different item

Posted by Sean Owen <sr...@gmail.com>.
Yes, you would need to explain more about what you are doing, but I can
guess:

When viewing an item, you are computing most-similar items and showing those
items. That process does not have anything to do with the user, so, yes you
will always get the same result.

How do you want the user to be involved here?



On Mon, Sep 20, 2010 at 4:28 PM, Sam Yang <ya...@gmail.com> wrote:

> All:
> When I use Item-based recommender to do recommendation for user,but for
> each
> item,the recommendations are same.
> Is there some way to return different recommendations for different item?
>
> And,my story is when one user loggined, show recommendations on item detail
> page,can these recommendations are different for each item?
>
> --
> I'm samsam.
>