On 20.10.2011 16:57, WangRamon wrote:
> 
> Hi Sebastian and Sean 
> Thanks for your help. 
> 
> I re-read the code again (debug seems to be very difficult for me to setup 
> the environment) and find the line in SimilarityMatrixRowWrapperMapper,  i 
> past it below with the comments: 
>     /* remove self similarity */ 
>     similarityMatrixRow.set(key.get(), Double.NaN); 
> I think the meanning is to mark the similarity between Item X and Item X (the 
> identical one) as NaN, but it doesn't exclude Item X from recommendation, 
> then in AggregateAndRecommendReducer, it uses simColumn.times(prefValue) as 
> part of the formula to calculate the preferences for all items that similar 
> to Item i (it could be Item X or some other item), then return the top 10 
> (default) for a user. 
> During this process, i cannot see any code to exclude an item which the user 
> has already given preference from recommendation. 

It's a little bit hidden :) For each preferred item, a vector of all its
similarities is added:

      numerators = numerators == null
          ? prefValue == BOOLEAN_PREF_VALUE ? simColumn.clone() :
simColumn.times(prefValue)
          : numerators.plus(prefValue == BOOLEAN_PREF_VALUE ? simColumn
: simColumn.times(prefValue));

But as the entry for the item itself is set to NaN in its similarity
vector and NaN plus something stays always NaN, the predicted preference
for an item that was already preferred is NaN. And the NaN entries are
dropped later.

--sebastian


> Correct me if i miss something, thank you guys. 
> Cheers Ramon
>> Date: Thu, 20 Oct 2011 13:59:28 +0100
>> Subject: Re: Recommend result contains item which user has already given 
>> preference, is that correct?
>> From: [email protected]
>> To: [email protected]
>>
>> Ah OK, figured as much. WangRamon does that answer your question
>> and/or can you debug to see if this is happening, not happening for
>> you in your use case?
>>
>> On Thu, Oct 20, 2011 at 1:42 PM, Sebastian Schelter <[email protected]> wrote:
>>> It's still included in SimilarityMatrixRowWrapperMapper. We also have a
>>> unit test that checks whether a user is only recommended unknown items
>>> which still works.
>                                         

Reply via email to