Example usage for org.apache.mahout.utils.clustering JsonClusterWriter JsonClusterWriter

List of usage examples for org.apache.mahout.utils.clustering JsonClusterWriter JsonClusterWriter

Introduction

In this page you can find the example usage for org.apache.mahout.utils.clustering JsonClusterWriter JsonClusterWriter.

Prototype

public JsonClusterWriter(Writer writer, Map<Integer, List<WeightedPropertyVectorWritable>> clusterIdToPoints,
            DistanceMeasure measure, int numTopFeatures, String[] dictionary) 

Source Link

Usage

From source file:tk.summerway.mahout9.tools.MyClusterDumper.java

License:Apache License

ClusterWriter createClusterWriter(Writer writer, String[] dictionary) throws IOException {
    ClusterWriter result;/*  w  w w .  j ava2  s  .com*/

    switch (outputFormat) {
    case TEXT:
        result = new ClusterDumperWriter(writer, clusterIdToPoints, measure, numTopFeatures, dictionary,
                subString);
        break;
    case CSV:
        result = new CSVClusterWriter(writer, clusterIdToPoints, measure);
        break;
    case GRAPH_ML:
        result = new GraphMLClusterWriter(writer, clusterIdToPoints, measure, numTopFeatures, dictionary,
                subString);
        break;
    case JSON:
        result = new JsonClusterWriter(writer, clusterIdToPoints, measure, numTopFeatures, dictionary);
        break;
    default:
        throw new IllegalStateException("Unknown outputformat: " + outputFormat);
    }
    return result;
}