mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r887528 - in /lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop: item/RecommenderJob.java item/RecommenderMapper.java pseudo/RecommenderJob.java pseudo/RecommenderMapper.java slopeone/SlopeOneAverageDiffsJob.java
Date Sat, 05 Dec 2009 11:48:53 GMT
Author: srowen
Date: Sat Dec  5 11:48:52 2009
New Revision: 887528

URL: http://svn.apache.org/viewvc?rev=887528&view=rev
Log:
More progress on CF Hadoop updates

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderJob.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderMapper.java
    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/RecommenderMapper.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/slopeone/SlopeOneAverageDiffsJob.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderJob.java?rev=887528&r1=887527&r2=887528&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderJob.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderJob.java
Sat Dec  5 11:48:52 2009
@@ -17,6 +17,7 @@
 
 package org.apache.mahout.cf.taste.hadoop.item;
 
+import org.apache.commons.cli2.Option;
 import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.mapred.JobClient;
 import org.apache.hadoop.mapred.JobConf;
@@ -37,11 +38,14 @@
 
   public static void main(String[] args) throws Exception {
 
-    Map<String,Object> parsedArgs = parseArguments(args);
+    Option numReccomendationsOpt = buildOption("numRecommendations", "n", "Number of recommendations
per user");
 
-    String prefsFile = parsedArgs.get("input").toString();
-    String outputPath = parsedArgs.get("output").toString();
-    String jarFile = parsedArgs.get("jarFile").toString();
+    Map<String,Object> parsedArgs = parseArguments(args, numReccomendationsOpt);
+
+    String prefsFile = parsedArgs.get("--input").toString();
+    String outputPath = parsedArgs.get("--output").toString();
+    String jarFile = parsedArgs.get("--jarFile").toString();
+    int recommendationsPerUser = Integer.parseInt((String) parsedArgs.get("--numRecommendations"));
     String userVectorPath = outputPath + "/userVectors";
     String cooccurrencePath = outputPath + "/cooccurrence";
 
@@ -82,6 +86,8 @@
                                              LongWritable.class,
                                              RecommendedItemsWritable.class,
                                              TextOutputFormat.class);
+    recommenderConf.set(RecommenderMapper.COOCCURRENCE_PATH, cooccurrencePath);
+    recommenderConf.setInt(RecommenderMapper.RECOMMENDATIONS_PER_USER, recommendationsPerUser);
     JobClient.runJob(recommenderConf);
   }
 

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderMapper.java?rev=887528&r1=887527&r2=887528&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderMapper.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderMapper.java
Sat Dec  5 11:48:52 2009
@@ -60,7 +60,7 @@
       throw new IllegalStateException(ioe);
     }
     cooccurrencePath = new Path(jobConf.get(COOCCURRENCE_PATH)).makeQualified(fs);
-    recommendationsPerUser = Integer.parseInt(jobConf.get(RECOMMENDATIONS_PER_USER));
+    recommendationsPerUser = jobConf.getInt(RECOMMENDATIONS_PER_USER, 10);
   }
 
   @Override

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=887528&r1=887527&r2=887528&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
Sat Dec  5 11:48:52 2009
@@ -110,13 +110,13 @@
     Option dataModelFileOpt = buildOption("dataModelFile", "m", "File containing preference
data");
 
     Map<String,Object> parsedArgs = parseArguments(args, recommendClassOpt, numReccomendationsOpt,
dataModelFileOpt);
-    String userIDFile = parsedArgs.get("input").toString();
-    String outputPath = parsedArgs.get("output").toString();
-    String jarFile = parsedArgs.get("jarFile").toString();
-
-    String recommendClassName = parsedArgs.get("recommenderClassName").toString();
-    int recommendationsPerUser = ((Number) parsedArgs.get("numRecommendations")).intValue();
-    String dataModelFile = parsedArgs.get("dataModelFile").toString();
+    String userIDFile = parsedArgs.get("--input").toString();
+    String outputPath = parsedArgs.get("--output").toString();
+    String jarFile = parsedArgs.get("--jarFile").toString();
+
+    String recommendClassName = parsedArgs.get("--recommenderClassName").toString();
+    int recommendationsPerUser = Integer.parseInt((String) parsedArgs.get("--numRecommendations"));
+    String dataModelFile = parsedArgs.get("--dataModelFile").toString();
 
     JobConf jobConf = prepareJobConf(userIDFile,
                                      outputPath,
@@ -131,7 +131,7 @@
                                      TextOutputFormat.class);
 
     jobConf.set(RecommenderMapper.RECOMMENDER_CLASS_NAME, recommendClassName);
-    jobConf.set(RecommenderMapper.RECOMMENDATIONS_PER_USER, String.valueOf(recommendationsPerUser));
+    jobConf.setInt(RecommenderMapper.RECOMMENDATIONS_PER_USER, recommendationsPerUser);
     jobConf.set(RecommenderMapper.DATA_MODEL_FILE, dataModelFile);
 
     JobClient.runJob(jobConf);

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/RecommenderMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/RecommenderMapper.java?rev=887528&r1=887527&r2=887528&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/RecommenderMapper.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/pseudo/RecommenderMapper.java
Sat Dec  5 11:48:52 2009
@@ -94,7 +94,7 @@
     } catch (InvocationTargetException ite) {
       throw new IllegalStateException(ite.getCause());
     }
-    recommendationsPerUser = Integer.parseInt(jobConf.get(RECOMMENDATIONS_PER_USER));
+    recommendationsPerUser = jobConf.getInt(RECOMMENDATIONS_PER_USER, 10);
   }
 
 

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/slopeone/SlopeOneAverageDiffsJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/slopeone/SlopeOneAverageDiffsJob.java?rev=887528&r1=887527&r2=887528&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/slopeone/SlopeOneAverageDiffsJob.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/slopeone/SlopeOneAverageDiffsJob.java
Sat Dec  5 11:48:52 2009
@@ -42,9 +42,9 @@
 
     Map<String,Object> parsedArgs = parseArguments(args);
 
-    String prefsFile = parsedArgs.get("input").toString();
-    String outputPath = parsedArgs.get("output").toString();
-    String jarFile = parsedArgs.get("jarFile").toString();
+    String prefsFile = parsedArgs.get("--input").toString();
+    String outputPath = parsedArgs.get("--output").toString();
+    String jarFile = parsedArgs.get("--jarFile").toString();
     String averagesOutputPath = outputPath + "/averages";
 
     JobConf prefsToDiffsJobConf = prepareJobConf(prefsFile,



Mime
View raw message