mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r890048 - in /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo: RecommenderJob.java UserIDsMapper.java
Date Sun, 13 Dec 2009 11:20:03 GMT
Author: srowen
Date: Sun Dec 13 11:20:02 2009
New Revision: 890048

URL: http://svn.apache.org/viewvc?rev=890048&view=rev
Log:
Additional change to enable usersFile

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/RecommenderJob.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/UserIDsMapper.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/RecommenderJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/RecommenderJob.java?rev=890048&r1=890047&r2=890048&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/RecommenderJob.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/RecommenderJob.java
Sun Dec 13 11:20:02 2009
@@ -105,11 +105,14 @@
     String outputPath = parsedArgs.get("--output");
     String jarFile = parsedArgs.get("--jarFile");
     String usersFile = parsedArgs.get("--usersFile");
+    if (usersFile == null) {
+      usersFile = inputFile;
+    }
 
     String recommendClassName = parsedArgs.get("--recommenderClassName");
     int recommendationsPerUser = Integer.parseInt(parsedArgs.get("--numRecommendations"));
 
-    JobConf jobConf = prepareJobConf(inputFile,
+    JobConf jobConf = prepareJobConf(usersFile,
                                      outputPath,
                                      jarFile,
                                      TextInputFormat.class,

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/UserIDsMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/UserIDsMapper.java?rev=890048&r1=890047&r2=890048&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/UserIDsMapper.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/UserIDsMapper.java
Sun Dec 13 11:20:02 2009
@@ -28,7 +28,7 @@
 import java.io.IOException;
 
 /**
- * Extracts and emits all user IDs from the input file.
+ * Extracts and emits all user IDs from the users file, or input file.
  */
 public final class UserIDsMapper
     extends MapReduceBase
@@ -40,7 +40,8 @@
                   OutputCollector<LongWritable, NullWritable> output,
                   Reporter reporter) throws IOException {
     String line = value.toString();
-    long userID = Long.parseLong(line.substring(0, line.indexOf(',')));
+    int comma = line.indexOf(',');
+    long userID = comma >= 0 ? Long.parseLong(line.substring(0, comma)) : Long.parseLong(line);
     output.collect(new LongWritable(userID), NullWritable.get());
   }
 



Mime
View raw message