Example usage for org.apache.mahout.clustering.iterator FuzzyKMeansClusteringPolicy FuzzyKMeansClusteringPolicy

List of usage examples for org.apache.mahout.clustering.iterator FuzzyKMeansClusteringPolicy FuzzyKMeansClusteringPolicy

Introduction

In this page you can find the example usage for org.apache.mahout.clustering.iterator FuzzyKMeansClusteringPolicy FuzzyKMeansClusteringPolicy.

Prototype

public FuzzyKMeansClusteringPolicy(double m, double convergenceDelta) 

Source Link

Usage

From source file:DisplayFuzzyKMeans.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 w w. ja va2  s  .c  o m
    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);
}

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 w  w .  ja v  a 2s .c  o  m*/
    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();
}