[ 
https://issues.apache.org/jira/browse/MAHOUT-432?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12884318#action_12884318
 ] 

Hui Wen Han commented on MAHOUT-432:
------------------------------------

The input is not cleared,because it can more accurately calculate user's 
similarity using all or most items in preferences than only using valid or new  
items in preferences.

the change seems  that it not much large,

we can just skip those items that are not in itemsFile when we add item to 
topItems.

 Queue<RecommendedItem> topItems = new 
PriorityQueue<RecommendedItem>(recommendationsPerUser + 1,
102     
Collections.reverseOrder(ByValueRecommendedItemComparator.getInstance()));
103     
104     Iterator<Vector.Element> recommendationVectorIterator =
105     recommendationVector.iterateNonZero();
106     while (recommendationVectorIterator.hasNext()) {
107     Vector.Element element = recommendationVectorIterator.next();
108     int index = element.index();
109     float value = (float) element.get();
110     if (!Float.isNaN(value)) {
111     if (topItems.size() < recommendationsPerUser) {
112     topItems.add(new GenericRecommendedItem(indexItemIDMap.get(index), 
value));
113     } else if (value > topItems.peek().getValue()) {
114     topItems.add(new GenericRecommendedItem(indexItemIDMap.get(index), 
value));
115     topItems.poll();
116     }
117     }
118     } 

> Can add one parameter --itemsFile for 
> org.apache.mahout.cf.taste.hadoop.item.RecommenderJob 
> --------------------------------------------------------------------------------------------
>
>                 Key: MAHOUT-432
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-432
>             Project: Mahout
>          Issue Type: New Feature
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Hui Wen Han
>            Assignee: Sean Owen
>            Priority: Minor
>             Fix For: 0.4
>
>
> Can add one parameter --itemsFile for 
> org.apache.mahout.cf.taste.hadoop.item.RecommenderJob ?
> --itemsFile some likes the the --usersFile.
> in some case, we want to calculate similarity using all preferences data ,
> but some item in  preferences  are old ,not available,behind the times or 
> retired ,
> we want that those data can not recommend to users, can only recommend user 
> with new or valid items.
> so we can add on paramete  --itemsFile for RecommenderJob, itemsFile includes 
> all the new valid items.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to