You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Jamey Wood <ja...@gmail.com> on 2011/11/29 18:32:55 UTC

Including a timestamp when setting preferences

It seems a bit surprising that there is no method along these lines in
DataModel (or some subclass thereof):

  setPreference(long userID, long itemID, float value, long time)

Am I just overlooking something?  Are you always expected to just go in
"under the covers" of some DataModel's implementation details to do this
(such as a raw SQL insert for a JDBC-based DataModel)?

Thanks,
Jamey

Re: Including a timestamp when setting preferences

Posted by Sean Owen <sr...@gmail.com>.
I think the idea is that this method always sets the time now, since it's
called now, whenever now is. Historical data is ingested differently,
through files or databases, and these can specify a time for each datum.

Does that address what you need to do?

On Tue, Nov 29, 2011 at 5:50 PM, Jamey Wood <ja...@gmail.com> wrote:

> Thanks for the response, Manuel.  But what I'm asking about here is a way
> to _set_ a time when storing a preference into a DataModel (i.e. control
> the value that'll subsequently be returned by the getPreferenceTime
> method).
>
> Thanks,
> Jamey
>
> On Tue, Nov 29, 2011 at 10:41 AM, Manuel Blechschmidt <
> Manuel.Blechschmidt@gmx.de> wrote:
>
> > Hi Jamey,
> >
> > On 29.11.2011, at 18:32, Jamey Wood wrote:
> >
> > > It seems a bit surprising that there is no method along these lines in
> > > DataModel (or some subclass thereof):
> > >
> > >  setPreference(long userID, long itemID, float value, long time)
> > >
> > > Am I just overlooking something?
> >
> > Yes you do, here you go:
> >
> >
> https://builds.apache.org/job/Mahout-Quality/javadoc/org/apache/mahout/cf/taste/model/DataModel.html#getPreferenceTime(long
> ,
> > long)
> >
> > Actually this does not support multiple times like Reratings or multiple
> > User Interactions. Nevertheless you get the preference time.
> >
> > > Are you always expected to just go in
> > > "under the covers" of some DataModel's implementation details to do
> this
> > > (such as a raw SQL insert for a JDBC-based DataModel)?
> > >
> > > Thanks,
> > > Jamey
> >
> >
> > /Manuel
> >
> > --
> > Manuel Blechschmidt
> > Dortustr. 57
> > 14467 Potsdam
> > Mobil: 0173/6322621
> > Twitter: http://twitter.com/Manuel_B
> >
> >
>

Re: Including a timestamp when setting preferences

Posted by Manuel Blechschmidt <Ma...@gmx.de>.
Hi Jamey,

On 29.11.2011, at 18:50, Jamey Wood wrote:

> Thanks for the response, Manuel.  But what I'm asking about here is a way
> to _set_ a time when storing a preference into a DataModel (i.e. control
> the value that'll subsequently be returned by the getPreferenceTime method).

Actually as far as I know this is not possible. The GenericDataModel has the ability to read time preferences during construction:
https://builds.apache.org/job/Mahout-Quality/javadoc/org/apache/mahout/cf/taste/impl/model/GenericDataModel.html#GenericDataModel(org.apache.mahout.cf.taste.impl.common.FastByIDMap, org.apache.mahout.cf.taste.impl.common.FastByIDMap)

Further it is very unlikely that you set the preferences through the DataModel. Normally you read the preferences from another system and the other system is responsible to update them.

If you have your own implementation you could provide an own method for also setting a time preference.

As far as I now there are currently no recommenders which use the time for recommendation. At the moment there is some discussion about adding recommenders which are able to find seasons or other timed data.

> 
> Thanks,
> Jamey

/Manuel

> 
> On Tue, Nov 29, 2011 at 10:41 AM, Manuel Blechschmidt <
> Manuel.Blechschmidt@gmx.de> wrote:
> 
>> Hi Jamey,
>> 
>> On 29.11.2011, at 18:32, Jamey Wood wrote:
>> 
>>> It seems a bit surprising that there is no method along these lines in
>>> DataModel (or some subclass thereof):
>>> 
>>> setPreference(long userID, long itemID, float value, long time)
>>> 
>>> Am I just overlooking something?
>> 
>> Yes you do, here you go:
>> 
>> https://builds.apache.org/job/Mahout-Quality/javadoc/org/apache/mahout/cf/taste/model/DataModel.html#getPreferenceTime(long,
>> long)
>> 
>> Actually this does not support multiple times like Reratings or multiple
>> User Interactions. Nevertheless you get the preference time.
>> 
>>> Are you always expected to just go in
>>> "under the covers" of some DataModel's implementation details to do this
>>> (such as a raw SQL insert for a JDBC-based DataModel)?
>>> 
>>> Thanks,
>>> Jamey
>> 
>> 
>> /Manuel
>> 
>> --
>> Manuel Blechschmidt
>> Dortustr. 57
>> 14467 Potsdam
>> Mobil: 0173/6322621
>> Twitter: http://twitter.com/Manuel_B
>> 
>> 

-- 
Manuel Blechschmidt
Dortustr. 57
14467 Potsdam
Mobil: 0173/6322621
Twitter: http://twitter.com/Manuel_B


Re: Including a timestamp when setting preferences

Posted by Jamey Wood <ja...@gmail.com>.
Thanks for the response, Manuel.  But what I'm asking about here is a way
to _set_ a time when storing a preference into a DataModel (i.e. control
the value that'll subsequently be returned by the getPreferenceTime method).

Thanks,
Jamey

On Tue, Nov 29, 2011 at 10:41 AM, Manuel Blechschmidt <
Manuel.Blechschmidt@gmx.de> wrote:

> Hi Jamey,
>
> On 29.11.2011, at 18:32, Jamey Wood wrote:
>
> > It seems a bit surprising that there is no method along these lines in
> > DataModel (or some subclass thereof):
> >
> >  setPreference(long userID, long itemID, float value, long time)
> >
> > Am I just overlooking something?
>
> Yes you do, here you go:
>
> https://builds.apache.org/job/Mahout-Quality/javadoc/org/apache/mahout/cf/taste/model/DataModel.html#getPreferenceTime(long,
> long)
>
> Actually this does not support multiple times like Reratings or multiple
> User Interactions. Nevertheless you get the preference time.
>
> > Are you always expected to just go in
> > "under the covers" of some DataModel's implementation details to do this
> > (such as a raw SQL insert for a JDBC-based DataModel)?
> >
> > Thanks,
> > Jamey
>
>
> /Manuel
>
> --
> Manuel Blechschmidt
> Dortustr. 57
> 14467 Potsdam
> Mobil: 0173/6322621
> Twitter: http://twitter.com/Manuel_B
>
>

Re: Including a timestamp when setting preferences

Posted by Manuel Blechschmidt <Ma...@gmx.de>.
Hi Jamey,

On 29.11.2011, at 18:32, Jamey Wood wrote:

> It seems a bit surprising that there is no method along these lines in
> DataModel (or some subclass thereof):
> 
>  setPreference(long userID, long itemID, float value, long time)
> 
> Am I just overlooking something?

Yes you do, here you go:
https://builds.apache.org/job/Mahout-Quality/javadoc/org/apache/mahout/cf/taste/model/DataModel.html#getPreferenceTime(long, long)

Actually this does not support multiple times like Reratings or multiple User Interactions. Nevertheless you get the preference time.

> Are you always expected to just go in
> "under the covers" of some DataModel's implementation details to do this
> (such as a raw SQL insert for a JDBC-based DataModel)?
> 
> Thanks,
> Jamey


/Manuel

-- 
Manuel Blechschmidt
Dortustr. 57
14467 Potsdam
Mobil: 0173/6322621
Twitter: http://twitter.com/Manuel_B