mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r825931 - in /lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example: ./ bookcrossing/ grouplens/ jester/ netflix/
Date Fri, 16 Oct 2009 15:18:39 GMT
Author: srowen
Date: Fri Oct 16 15:18:37 2009
New Revision: 825931

URL: http://svn.apache.org/viewvc?rev=825931&view=rev
Log:
Make TasteOptionParser static

Modified:
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/TasteOptionParser.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingRecommenderEvaluatorRunner.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensRecommenderEvaluatorRunner.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/jester/JesterRecommenderEvaluatorRunner.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixRecommenderEvaluatorRunner.java
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/TransposeToByUser.java

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/TasteOptionParser.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/TasteOptionParser.java?rev=825931&r1=825930&r2=825931&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/TasteOptionParser.java
(original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/TasteOptionParser.java
Fri Oct 16 15:18:37 2009
@@ -20,15 +20,17 @@
  * 
  * The class is safe to be used in threaded contexts.
  */
-public class TasteOptionParser {
+public final class TasteOptionParser {
+
+  private TasteOptionParser() {
+  }
 
   /**
    * Parse the given command line arguments.
    * @param args the arguments as given to the application.
    * @return the input file if a file was given on the command line, null otherwise. 
-   * */
-  public File getRatings(final String[] args) throws OptionException {
-    File file = null;
+   */
+  public static File getRatings(String[] args) throws OptionException {
     DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
     ArgumentBuilder abuilder = new ArgumentBuilder();
     GroupBuilder gbuilder = new GroupBuilder();
@@ -49,12 +51,11 @@
 
     if (cmdLine.hasOption(helpOpt)) {
       CommandLineUtil.printHelp(group);
-      System.exit(0);
+      return null;
     }
 
     String prefsFile = cmdLine.getValue(inputOpt).toString();
-    file = new File(prefsFile);
-    return file;
+    return new File(prefsFile);
   }
 
 }

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingRecommenderEvaluatorRunner.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingRecommenderEvaluatorRunner.java?rev=825931&r1=825930&r2=825931&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingRecommenderEvaluatorRunner.java
(original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/bookcrossing/BookCrossingRecommenderEvaluatorRunner.java
Fri Oct 16 15:18:37 2009
@@ -40,8 +40,7 @@
   public static void main(String... args) throws IOException, TasteException, OptionException
{
     RecommenderEvaluator evaluator = new AverageAbsoluteDifferenceRecommenderEvaluator();
     DataModel model;
-    TasteOptionParser parser = new TasteOptionParser();
-    File ratingsFile = parser.getRatings(args);
+    File ratingsFile = TasteOptionParser.getRatings(args);
     if (ratingsFile != null) {
       model = new BookCrossingDataModel(ratingsFile);
     } else {

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensRecommenderEvaluatorRunner.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensRecommenderEvaluatorRunner.java?rev=825931&r1=825930&r2=825931&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensRecommenderEvaluatorRunner.java
(original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensRecommenderEvaluatorRunner.java
Fri Oct 16 15:18:37 2009
@@ -44,8 +44,7 @@
   public static void main(String... args) throws IOException, TasteException, OptionException
{
     RecommenderEvaluator evaluator = new AverageAbsoluteDifferenceRecommenderEvaluator();
     DataModel model;
-    TasteOptionParser parser = new TasteOptionParser();
-    File ratingsFile = parser.getRatings(args);
+    File ratingsFile = TasteOptionParser.getRatings(args);
     if (ratingsFile != null) {
       model = new GroupLensDataModel(ratingsFile);
     } else {

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/jester/JesterRecommenderEvaluatorRunner.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/jester/JesterRecommenderEvaluatorRunner.java?rev=825931&r1=825930&r2=825931&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/jester/JesterRecommenderEvaluatorRunner.java
(original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/jester/JesterRecommenderEvaluatorRunner.java
Fri Oct 16 15:18:37 2009
@@ -40,8 +40,7 @@
   public static void main(String... args) throws IOException, TasteException, OptionException
{
     RecommenderEvaluator evaluator = new AverageAbsoluteDifferenceRecommenderEvaluator();
     DataModel model;
-    TasteOptionParser parser = new TasteOptionParser();
-    File ratingsFile = parser.getRatings(args);
+    File ratingsFile = TasteOptionParser.getRatings(args);
     if (ratingsFile != null) {
       model = new JesterDataModel(ratingsFile);
     } else {

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixRecommenderEvaluatorRunner.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixRecommenderEvaluatorRunner.java?rev=825931&r1=825930&r2=825931&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixRecommenderEvaluatorRunner.java
(original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/NetflixRecommenderEvaluatorRunner.java
Fri Oct 16 15:18:37 2009
@@ -39,8 +39,7 @@
 
   public static void main(String... args) throws IOException, TasteException, OptionException
{
     RecommenderEvaluator evaluator = new AverageAbsoluteDifferenceRecommenderEvaluator();
-    TasteOptionParser parser = new TasteOptionParser();
-    File ratingsFile = parser.getRatings(args);
+    File ratingsFile = TasteOptionParser.getRatings(args);
     if (ratingsFile != null) {
       DataModel model = new NetflixDataModel(ratingsFile, true);
       double evaluation = evaluator.evaluate(new NetflixRecommenderBuilder(), null, model,
0.9, 0.1);

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/TransposeToByUser.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/TransposeToByUser.java?rev=825931&r1=825930&r2=825931&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/TransposeToByUser.java
(original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/netflix/TransposeToByUser.java
Fri Oct 16 15:18:37 2009
@@ -44,8 +44,7 @@
 
   public static void main(String[] args) throws IOException, OptionException {
 
-    TasteOptionParser parser = new TasteOptionParser();
-    File dataDirectory = parser.getRatings(args);
+    File dataDirectory = TasteOptionParser.getRatings(args);
     File byItemDirectory = new File(dataDirectory, "training_set");
     File byUserDirectory = new File(dataDirectory, "training_set_by_user");
 



Mime
View raw message