Example usage for org.apache.mahout.clustering.classify ClusterClassifier close

List of usage examples for org.apache.mahout.clustering.classify ClusterClassifier close

Introduction

In this page you can find the example usage for org.apache.mahout.clustering.classify ClusterClassifier close.

Prototype

@Override
    public void close() 

Source Link

Usage

From source file:org.aksw.tsoru.textmining.mahout.plot.Display.java

License:Apache License

private static void runSequentialFuzzyKClassifier(Configuration conf, Path samples, Path output,
        DistanceMeasure measure, int numClusters, int maxIterations, float m, double threshold)
        throws IOException {
    Collection<Vector> points = Lists.newArrayList();
    for (int i = 0; i < numClusters; i++) {
        points.add(SAMPLE_DATA.get(i).get());
    }//from  w ww. ja va  2s  .  com
    List<Cluster> initialClusters = Lists.newArrayList();
    int id = 0;
    for (Vector point : points) {
        initialClusters.add(new SoftCluster(point, id++, measure));
    }
    ClusterClassifier prior = new ClusterClassifier(initialClusters,
            new FuzzyKMeansClusteringPolicy(m, threshold));
    Path priorPath = new Path(output, "classifier-0");
    prior.writeToSeqFiles(priorPath);

    ClusterIterator.iterateSeq(conf, samples, priorPath, output, maxIterations);
    loadClustersWritable(output);

    prior.close();
}