You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Sean Owen <sr...@gmail.com> on 2010/10/27 10:40:08 UTC

Re: Anonymous user and CachingRecommender

That's fine, though user@ is also fine since that way other users see the
question.

Yes that's actually important, as you don't want it to cache the
recommendation for the anonymous user, since it could then be reused for
another totally different user.

Your proposal would fix it, though kinda couples the caching wrapper to a
particular implementation. Maybe that's a minor sin, to consider
Long.MIN_VALUE a special case user ID across the board. In this case, the
only possible bad effect is that it doesn't cache result for one user, which
is nothing.

On Wed, Oct 27, 2010 at 9:17 AM, Philippe Adjiman <ad...@gmail.com> wrote:

> Hi,
>
> I'm not part of the dev team but as my question relates directly to mahout
> (taste) code I'm sending that email to the dev team.
>
> When using a cachingRecommender, if recommendations are requested for an
> anonymous user (using a plusAnonymousDataModel) I wondered if caching those
> recommendations was not a waste of a cache entry (as the user is
> temporary).
>
> So, does it makes sense to add in the *recommend* method of the
> CachingRecommender class a filter that will not cache the recommendation of
> a user having the id Long.MIN_VALUE (which is the user id of a temporary
> user as I saw in the PlusAnonymousUserDataModel class)?
>
> Thanks,
> Philippe Adjiman.
>

Re: Anonymous user and CachingRecommender

Posted by Philippe Adjiman <ad...@gmail.com>.
In the meantime, as I want to keep the benefit of caching while allowing
anonymous users, I'm clearing the cache for TEMP_USER_ID after each
anonymous user recommendation call.
Thanks for your answers.

On Wed, Oct 27, 2010 at 11:09 AM, Sean Owen <sr...@gmail.com> wrote:

> Yes, well right now you'd need to manage that yourself, which isn't too
> hard
> -- just clear the cache for that user ID, or don't use the caching wrapper.
> But it's easy enough to bake into class itself. I can't commit now since
> we're in a release but shouldn't be too long.
>
> On Wed, Oct 27, 2010 at 10:06 AM, Philippe Adjiman <adjiman@gmail.com
> >wrote:
>
> > Hi Sean,
> >
> > agreed.
> > so until a fix, one should be aware to not use a CachingRecommender in
> > combination with a PlusAnomymousDataModel else the recommendations for
> > anonymous users will always be the same (the ones of the first cached
> user
> > of that kind, until its cache is removed) and thus wrong for almost all
> the
> > anonymous users.
> > Is that correct?
> >
> >
> > On Wed, Oct 27, 2010 at 10:40 AM, Sean Owen <sr...@gmail.com> wrote:
> >
> > > That's fine, though user@ is also fine since that way other users see
> > the
> > > question.
> > >
> > > Yes that's actually important, as you don't want it to cache the
> > > recommendation for the anonymous user, since it could then be reused
> for
> > > another totally different user.
> > >
> > > Your proposal would fix it, though kinda couples the caching wrapper to
> a
> > > particular implementation. Maybe that's a minor sin, to consider
> > > Long.MIN_VALUE a special case user ID across the board. In this case,
> the
> > > only possible bad effect is that it doesn't cache result for one user,
> > > which
> > > is nothing.
> > >
> > > On Wed, Oct 27, 2010 at 9:17 AM, Philippe Adjiman <ad...@gmail.com>
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > I'm not part of the dev team but as my question relates directly to
> > > mahout
> > > > (taste) code I'm sending that email to the dev team.
> > > >
> > > > When using a cachingRecommender, if recommendations are requested for
> > an
> > > > anonymous user (using a plusAnonymousDataModel) I wondered if caching
> > > those
> > > > recommendations was not a waste of a cache entry (as the user is
> > > > temporary).
> > > >
> > > > So, does it makes sense to add in the *recommend* method of the
> > > > CachingRecommender class a filter that will not cache the
> > recommendation
> > > of
> > > > a user having the id Long.MIN_VALUE (which is the user id of a
> > temporary
> > > > user as I saw in the PlusAnonymousUserDataModel class)?
> > > >
> > > > Thanks,
> > > > Philippe Adjiman.
> > > >
> > >
> >
>

Re: Anonymous user and CachingRecommender

Posted by Sean Owen <sr...@gmail.com>.
Yes, well right now you'd need to manage that yourself, which isn't too hard
-- just clear the cache for that user ID, or don't use the caching wrapper.
But it's easy enough to bake into class itself. I can't commit now since
we're in a release but shouldn't be too long.

On Wed, Oct 27, 2010 at 10:06 AM, Philippe Adjiman <ad...@gmail.com>wrote:

> Hi Sean,
>
> agreed.
> so until a fix, one should be aware to not use a CachingRecommender in
> combination with a PlusAnomymousDataModel else the recommendations for
> anonymous users will always be the same (the ones of the first cached user
> of that kind, until its cache is removed) and thus wrong for almost all the
> anonymous users.
> Is that correct?
>
>
> On Wed, Oct 27, 2010 at 10:40 AM, Sean Owen <sr...@gmail.com> wrote:
>
> > That's fine, though user@ is also fine since that way other users see
> the
> > question.
> >
> > Yes that's actually important, as you don't want it to cache the
> > recommendation for the anonymous user, since it could then be reused for
> > another totally different user.
> >
> > Your proposal would fix it, though kinda couples the caching wrapper to a
> > particular implementation. Maybe that's a minor sin, to consider
> > Long.MIN_VALUE a special case user ID across the board. In this case, the
> > only possible bad effect is that it doesn't cache result for one user,
> > which
> > is nothing.
> >
> > On Wed, Oct 27, 2010 at 9:17 AM, Philippe Adjiman <ad...@gmail.com>
> > wrote:
> >
> > > Hi,
> > >
> > > I'm not part of the dev team but as my question relates directly to
> > mahout
> > > (taste) code I'm sending that email to the dev team.
> > >
> > > When using a cachingRecommender, if recommendations are requested for
> an
> > > anonymous user (using a plusAnonymousDataModel) I wondered if caching
> > those
> > > recommendations was not a waste of a cache entry (as the user is
> > > temporary).
> > >
> > > So, does it makes sense to add in the *recommend* method of the
> > > CachingRecommender class a filter that will not cache the
> recommendation
> > of
> > > a user having the id Long.MIN_VALUE (which is the user id of a
> temporary
> > > user as I saw in the PlusAnonymousUserDataModel class)?
> > >
> > > Thanks,
> > > Philippe Adjiman.
> > >
> >
>

Re: Anonymous user and CachingRecommender

Posted by Philippe Adjiman <ad...@gmail.com>.
Hi Sean,

agreed.
so until a fix, one should be aware to not use a CachingRecommender in
combination with a PlusAnomymousDataModel else the recommendations for
anonymous users will always be the same (the ones of the first cached user
of that kind, until its cache is removed) and thus wrong for almost all the
anonymous users.
Is that correct?


On Wed, Oct 27, 2010 at 10:40 AM, Sean Owen <sr...@gmail.com> wrote:

> That's fine, though user@ is also fine since that way other users see the
> question.
>
> Yes that's actually important, as you don't want it to cache the
> recommendation for the anonymous user, since it could then be reused for
> another totally different user.
>
> Your proposal would fix it, though kinda couples the caching wrapper to a
> particular implementation. Maybe that's a minor sin, to consider
> Long.MIN_VALUE a special case user ID across the board. In this case, the
> only possible bad effect is that it doesn't cache result for one user,
> which
> is nothing.
>
> On Wed, Oct 27, 2010 at 9:17 AM, Philippe Adjiman <ad...@gmail.com>
> wrote:
>
> > Hi,
> >
> > I'm not part of the dev team but as my question relates directly to
> mahout
> > (taste) code I'm sending that email to the dev team.
> >
> > When using a cachingRecommender, if recommendations are requested for an
> > anonymous user (using a plusAnonymousDataModel) I wondered if caching
> those
> > recommendations was not a waste of a cache entry (as the user is
> > temporary).
> >
> > So, does it makes sense to add in the *recommend* method of the
> > CachingRecommender class a filter that will not cache the recommendation
> of
> > a user having the id Long.MIN_VALUE (which is the user id of a temporary
> > user as I saw in the PlusAnonymousUserDataModel class)?
> >
> > Thanks,
> > Philippe Adjiman.
> >
>