Author: jeastman
Date: Sat Jun 9 20:54:35 2012
New Revision: 1348502
URL: http://svn.apache.org/viewvc?rev=1348502&view=rev
Log:
Added some better logging diagnostics and trying clustersIn change to
cluster-reuters.sh
Modified:
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansUtil.java
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java
Modified:
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
URL:
http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java?rev=1348502&r1=1348501&r2=1348502&view=diff
==============================================================================
---
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
(original)
+++
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
Sat Jun 9 20:54:35 2012
@@ -215,10 +215,10 @@ public class KMeansDriver extends Abstra
KMeansUtil.configureWithClusterInfo(conf, clustersIn, clusters);
if (clusters.isEmpty()) {
- throw new IllegalStateException("No input clusters found. Check your -c
argument.");
+ throw new IllegalStateException("No input clusters found in " +
clustersIn + ". Check your -c argument.");
}
- Path priorClustersPath = new Path(output, Cluster.INITIAL_CLUSTERS_DIR);
+ Path priorClustersPath = new Path(output, Cluster.INITIAL_CLUSTERS_DIR);
ClusteringPolicy policy = new KMeansClusteringPolicy(convergenceDelta);
ClusterClassifier prior = new ClusterClassifier(clusters, policy);
prior.writeToSeqFiles(priorClustersPath);
Modified:
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansUtil.java
URL:
http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansUtil.java?rev=1348502&r1=1348501&r2=1348502&view=diff
==============================================================================
---
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansUtil.java
(original)
+++
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansUtil.java
Sat Jun 9 20:54:35 2012
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
package org.apache.mahout.clustering.kmeans;
import java.util.Collection;
@@ -28,14 +28,17 @@ import org.apache.mahout.clustering.iter
import org.apache.mahout.common.iterator.sequencefile.PathFilters;
import org.apache.mahout.common.iterator.sequencefile.PathType;
import
org.apache.mahout.common.iterator.sequencefile.SequenceFileDirValueIterable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
final class KMeansUtil {
+
+ private static final Logger log = LoggerFactory.getLogger(KMeansUtil.class);
- private KMeansUtil() {
- }
-
+ private KMeansUtil() {}
+
/**
- * Create a list of Klusters from whatever type is passed in as the prior
+ * Create a list of Klusters from whatever Cluster type is passed in as the
prior
*
* @param conf
* the Configuration
@@ -44,17 +47,16 @@ final class KMeansUtil {
* @param clusters
* a List<Cluster> to put values into
*/
- public static void configureWithClusterInfo(Configuration conf,
- Path clusterPath,
- Collection<Cluster> clusters) {
- for (Writable value :
- new SequenceFileDirValueIterable<Writable>(clusterPath,
PathType.LIST, PathFilters.partFilter(), conf)) {
+ public static void configureWithClusterInfo(Configuration conf, Path
clusterPath, Collection<Cluster> clusters) {
+ for (Writable value : new
SequenceFileDirValueIterable<Writable>(clusterPath, PathType.LIST,
+ PathFilters.partFilter(), conf)) {
Class<? extends Writable> valueClass = value.getClass();
if (valueClass.equals(ClusterWritable.class)) {
- ClusterWritable clusterWritable = (ClusterWritable)value;
- value = clusterWritable.getValue();
- valueClass = value.getClass();
+ ClusterWritable clusterWritable = (ClusterWritable) value;
+ value = clusterWritable.getValue();
+ valueClass = value.getClass();
}
+ log.info("Read 1 Cluster from {}", clusterPath);
if (valueClass.equals(Kluster.class)) {
// get the cluster info
@@ -68,5 +70,5 @@ final class KMeansUtil {
}
}
}
-
+
}
\ No newline at end of file
Modified:
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java
URL:
http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java?rev=1348502&r1=1348501&r2=1348502&view=diff
==============================================================================
---
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java
(original)
+++
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/RandomSeedGenerator.java
Sat Jun 9 20:54:35 2012
@@ -114,7 +114,7 @@ public final class RandomSeedGenerator {
for (int i = 0; i < chosenTexts.size(); i++) {
writer.append(chosenTexts.get(i), chosenClusters.get(i));
}
- log.info("Wrote {} vectors to {}", k, outFile);
+ log.info("Wrote {} Klusters to {}", k, outFile);
} finally {
Closeables.closeQuietly(writer);
}