mahout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hui Wen Han (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MAHOUT-359) org.apache.mahout.cf.taste.hadoop.item.RecommenderJob for Boolean recommendation
Date Fri, 02 Apr 2010 14:08:28 GMT

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

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

sorry for confusing you.

I have two questions:

1) if item has no preferences,we normally set the  preferences to 0 or null in database:

if (columnVector != null) { columnVector.times(value).addTo(recommendationVector)  will cause
all value has same value,

2) if item has no preferences,we normally set the  preferences to 0 or null:

in ToUserVectorReducer.class we need not select the top N items,becasue they have the same
default value (0 or null)

we can take all items ,it will decrease the calculatation time ,so improve the performance.

very thanks


> org.apache.mahout.cf.taste.hadoop.item.RecommenderJob for Boolean recommendation
> --------------------------------------------------------------------------------
>
>                 Key: MAHOUT-359
>                 URL: https://issues.apache.org/jira/browse/MAHOUT-359
>             Project: Mahout
>          Issue Type: Bug
>          Components: Collaborative Filtering
>    Affects Versions: 0.4
>            Reporter: Hui Wen Han
>
> in some case there has no preference value in the input data ,the preference value is
set to zero,then 
> RecommenderMapper.class
> line 119:
>  @Override
>   public void map(LongWritable userID,
>                   VectorWritable vectorWritable,
>                   OutputCollector<LongWritable,RecommendedItemsWritable> output,
>                   Reporter reporter) throws IOException {
>     
>     if ((usersToRecommendFor != null) && !usersToRecommendFor.contains(userID.get()))
{
>       return;
>     }
>     Vector userVector = vectorWritable.get();
>     Iterator<Vector.Element> userVectorIterator = userVector.iterateNonZero();
>     Vector recommendationVector = new RandomAccessSparseVector(Integer.MAX_VALUE, 1000);
>     while (userVectorIterator.hasNext()) {
>       Vector.Element element = userVectorIterator.next();
>       int index = element.index();
>       double value = element.get();     //here will get 0.0 for Boolean recommendation

>       Vector columnVector;
>       try {
>         columnVector = cooccurrenceColumnCache.get(new IntWritable(index));
>       } catch (TasteException te) {
>         if (te.getCause() instanceof IOException) {
>           throw (IOException) te.getCause();
>         } else {
>           throw new IOException(te.getCause());
>         }
>       }
>       if (columnVector != null) {
>         columnVector.times(value).addTo(recommendationVector); //here will set all score
value to zero for Boolean recommendation
>       }
>     }
>     
>     Queue<RecommendedItem> topItems = new PriorityQueue<RecommendedItem>(recommendationsPerUser
+ 1,
>         Collections.reverseOrder());
>     
>     Iterator<Vector.Element> recommendationVectorIterator = recommendationVector.iterateNonZero();
>     LongWritable itemID = new LongWritable();
>     while (recommendationVectorIterator.hasNext()) {
>       Vector.Element element = recommendationVectorIterator.next();
>       int index = element.index();
>       if (userVector.get(index) == 0.0) {
>         if (topItems.size() < recommendationsPerUser) {
>           indexItemIDMap.get(new IntWritable(index), itemID);
>           topItems.add(new GenericRecommendedItem(itemID.get(), (float) element.get()));
>         } else if (element.get() > topItems.peek().getValue()) {
>           indexItemIDMap.get(new IntWritable(index), itemID);
>           topItems.add(new GenericRecommendedItem(itemID.get(), (float) element.get()));
>           topItems.poll();
>         }
>       }
>     }
>     
>     List<RecommendedItem> recommendations = new ArrayList<RecommendedItem>(topItems.size());
>     recommendations.addAll(topItems);
>     Collections.sort(recommendations);
>     output.collect(userID, new RecommendedItemsWritable(recommendations));
>   }
> so maybe we need a option to distinguish boolean recommendation and slope one recommendation.
> in ToUserVectorReducer.class
> here no need findTopNPrefsCutoff,maybe take all item.
> it's just my thinking ,maybe item is used for slope one only .
> :)
>  

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


Mime
View raw message