mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r656458 - in /lucene/mahout/trunk/core/src/main/java/org/apache/mahout: cf/taste/impl/recommender/slopeone/jdbc/ clustering/kmeans/ clustering/meanshift/ utils/parameters/
Date Wed, 14 May 2008 23:05:11 GMT
Author: srowen
Date: Wed May 14 16:05:10 2008
New Revision: 656458

URL: http://svn.apache.org/viewvc?rev=656458&view=rev
Log:
Continued shift to SLF4J

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/jdbc/MySQLJDBCDiffStorage.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyDriver.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyJob.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/utils/parameters/Parametered.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/jdbc/MySQLJDBCDiffStorage.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/jdbc/MySQLJDBCDiffStorage.java?rev=656458&r1=656457&r2=656458&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/jdbc/MySQLJDBCDiffStorage.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/slopeone/jdbc/MySQLJDBCDiffStorage.java
Wed May 14 16:05:10 2008
@@ -133,22 +133,4 @@
           minDiffCount);
   }
 
-  /*
-   public static void main(final String... args) throws Exception {
-     Logger.getLogger("org.apache.mahout.cf.taste").setLevel(Level.FINE);
-     final MysqlDataSource dataSource = new MysqlDataSource();
-     dataSource.setUser("mysql");
-     dataSource.setDatabaseName("test");
-     dataSource.setServerName("localhost");
-     final DataSource pooledDataSource = new ConnectionPoolDataSource(dataSource);
-     final MySQLJDBCDataModel model = new MySQLJDBCDataModel(pooledDataSource);
-     final MySQLJDBCDiffStorage diffStorage = new MySQLJDBCDiffStorage(model);
-     final Recommender slopeOne = new SlopeOneRecommender(model, true, false, diffStorage);
-     long start = System.currentTimeMillis();
-     System.out.println(slopeOne.recommend(args[0], 20));
-     long end = System.currentTimeMillis();
-     System.out.println(end - start);
-   }
-    */
-
 }
\ No newline at end of file

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java?rev=656458&r1=656457&r2=656458&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
Wed May 14 16:05:10 2008
@@ -23,11 +23,15 @@
 import org.apache.hadoop.mapred.JobClient;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.SequenceFileOutputFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 
 public class KMeansDriver {
 
+  private static final Logger log = LoggerFactory.getLogger(KMeansDriver.class);
+
   private KMeansDriver() {
   }
 
@@ -68,7 +72,7 @@
       int iteration = 0;
 
       while (!converged && iteration < maxIter) {
-        System.out.println("Iteration " + iteration);
+        log.info("Iteration {}", iteration);
         // point the output to a new directory per iteration
         String clustersOut = output + "/clusters-" + iteration;
         converged = runIteration(input, clustersIn, clustersOut, measureClass,
@@ -78,7 +82,7 @@
         iteration++;
       }
       // now actually cluster the points
-      System.out.println("Clustering ");
+      log.info("Clustering ");
       runClustering(input, clustersIn, output + "/points", measureClass,
               convergenceDelta);
     } catch (Exception e) {
@@ -123,7 +127,7 @@
       FileSystem fs = FileSystem.get(conf);
       return isConverged(clustersOut + "/part-00000", conf, fs);
     } catch (Exception e) {
-      e.printStackTrace();
+      log.warn(e.toString(), e);
       return true;
     }
   }
@@ -159,7 +163,7 @@
     try {
       JobClient.runJob(conf);
     } catch (Exception e) {
-      e.printStackTrace();
+      log.warn(e.toString(), e);
     }
   }
 

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyDriver.java?rev=656458&r1=656457&r2=656458&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyDriver.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyDriver.java
Wed May 14 16:05:10 2008
@@ -22,9 +22,13 @@
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.SequenceFileInputFormat;
 import org.apache.hadoop.mapred.SequenceFileOutputFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class MeanShiftCanopyDriver {
 
+  private static final Logger log = LoggerFactory.getLogger(MeanShiftCanopyDriver.class);
+
   public static void main(String[] args) {
     String input = args[0];
     String output = args[1];
@@ -76,7 +80,7 @@
     try {
       JobClient.runJob(conf);
     } catch (Exception e) {
-      e.printStackTrace();
+      log.warn(e.toString(), e);
     }
   }
 }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyJob.java?rev=656458&r1=656457&r2=656458&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyJob.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyJob.java
Wed May 14 16:05:10 2008
@@ -16,16 +16,20 @@
  */
 package org.apache.mahout.clustering.meanshift;
 
-import java.io.IOException;
-
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.SequenceFile;
 import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapred.JobConf;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
 
 public class MeanShiftCanopyJob {
 
+  private static final Logger log = LoggerFactory.getLogger(MeanShiftCanopyJob.class);
+
   public static void main(String[] args) {
     String input = args[0];
     String output = args[1];
@@ -67,7 +71,7 @@
       int iteration = 0;
       String clustersIn = input;
       while (!converged && iteration < maxIterations) {
-        System.out.println("Iteration " + iteration);
+        log.info("Iteration {}", iteration);
         // point the output to a new directory per iteration
         String clustersOut = output + "/canopies-" + iteration;
         MeanShiftCanopyDriver.runJob(clustersIn, clustersOut, measureClassName,

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/utils/parameters/Parametered.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/utils/parameters/Parametered.java?rev=656458&r1=656457&r2=656458&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/utils/parameters/Parametered.java
(original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/utils/parameters/Parametered.java
Wed May 14 16:05:10 2008
@@ -17,10 +17,10 @@
 
 package org.apache.mahout.utils.parameters;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.JobConfigurable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.util.Collection;
 
@@ -29,7 +29,7 @@
  */
 public interface Parametered extends JobConfigurable {
 
-  public static final Log log = LogFactory.getLog(Parametered.class);
+  public static final Logger log = LoggerFactory.getLogger(Parametered.class);
 
 
   public abstract Collection<Parameter> getParameters();



Mime
View raw message