Example usage for org.apache.mahout.clustering.kmeans KMeansDriver setConf

List of usage examples for org.apache.mahout.clustering.kmeans KMeansDriver setConf

Introduction

In this page you can find the example usage for org.apache.mahout.clustering.kmeans KMeansDriver setConf.

Prototype

@Override
public void setConf(Configuration conf) 

Source Link

Document

Overrides the base implementation to install the Oozie action configuration resource into the provided Configuration object; note that ToolRunner calls setConf on the Tool before it invokes run.

Usage

From source file:com.modofo.molo.cluster.Clusterer.java

License:Apache License

public void run(String topicId) {
    String inputDir = this.tempDir + "/" + topicId + "/" + topicId + "-vectors/tfidf-vectors";
    String clusterDir = this.tempDir + "/" + topicId + "-clusters";
    String outputDir = this.tempDir + "/" + topicId + "/cluster";
    String[] args = { "-i", inputDir, "-c", clusterDir, "-o", outputDir, "-dm",
            org.apache.mahout.common.distance.CosineDistanceMeasure.class.getName(), "-cd", "0.1", "-x", "10",
            "-k", "20", "-ow" };
    try {/*from   w  ww  . j a v a 2s  .co  m*/
        KMeansDriver kd = new KMeansDriver();
        kd.setConf(new Configuration());
        kd.run(args);
    } catch (Exception e) {
        e.printStackTrace();
    }

}