mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Suglia <alessandro.sug...@yahoo.com>
Subject Re: Mahout recommendation in implicit feedback situation
Date Sat, 03 May 2014 15:00:07 GMT
Sorry Sebastian, maybe you haven't the possibility to read the post on 
SO, so I'll report the code here.
I've already used the GenericBooleanPrefUserBasedRecommender in order to 
generate the recommendation and the results are the same.

|     DataModel  trainModel=  new  FileDataModel(new  File(String.valueOf(Main.class.getResource("/binarized/u1.base").getFile())));
     DataModel  testModel=  new  FileDataModel(new  File(String.valueOf(Main.class.getResource("/binarized/u1.test").getFile())));
     UserSimilarity  similarity=  new  TanimotoCoefficientSimilarity(trainModel);
     UserNeighborhood  neighborhood=  new  NearestNUserNeighborhood(35,  similarity,  trainModel);

     GenericBooleanPrefUserBasedRecommender  userBased=  new  GenericBooleanPrefUserBasedRecommender(trainModel,
 neighborhood,  similarity);

     long  firstUser=  testModel.getUserIDs().nextLong();  // get the first user

     // try to recommender items for the first user
     for(LongPrimitiveIterator  iterItem=  testModel.getItemIDsFromUser(firstUser).iterator();
 iterItem.hasNext();  )  {
         long  currItem=  iterItem.nextLong();
         // estimates preference for the current item for the first user
         System.out.println("Estimated preference for item"  +  currItem+  " is"  +  userBased.estimatePreference(firstUser,
 currItem));

     }

|

Can you explain to me where is the error in this code?

Thank you.

On 05/03/14 16:42, Sebastian Schelter wrote:
> You should try the
>
> org.apache.mahout.cf.taste.impl.recommender.GenericBooleanPrefUserBasedRecommender 
>
>
> which has been built to handle such data.
>
> Best,
> Sebastian
>
>
> On 05/03/2014 04:34 PM, Alessandro Suglia wrote:
>> I have described it in the SO's post:
>> "When I execute this code, the result is a list of 0.0 or 1.0 which are
>> not useful in the context of top-n recommendation in implicit feedback
>> context. Simply because I have to obtain, for each item, an estimated
>> rate which stays in the range [0, 1] in order to rank the list in
>> decreasing order and construct the top-n recommendation appropriately."
>> On 05/03/14 16:25, Sebastian Schelter wrote:
>>> Hi Allessandro,
>>>
>>> what result do you expect and what do you get? Can you give a concrete
>>> example?
>>>
>>> --sebastian
>>>
>>> On 05/03/2014 12:11 PM, Alessandro Suglia wrote:
>>>> Good morning,
>>>> I've tried to create a recommender system using Mahout in an implicit
>>>> feedback situation. What I'm trying to do is explained exactlly in 
>>>> this
>>>> post on stack overflow:
>>>> http://stackoverflow.com/questions/23077735/mahout-recommendation-in-implicit-feedback-situation.

>>>>
>>>>
>>>> <http://stackoverflow.com/questions/23077735/mahout-recommendation-in-implicit-feedback-situation>

>>>>
>>>>
>>>>
>>>> As you can see, I'm having some problem with it simply because I 
>>>> cannot
>>>> get the result that I expect (a value between 0 and 1) when I try to
>>>> predict a score for a specific item.
>>>>
>>>> Someone here can help me, please?
>>>>
>>>> Thank you in advance.
>>>>
>>>> Alessandro Suglia
>>>>
>>>
>>
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message