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

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

Introduction

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

Prototype

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

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;/*from  w  ww. j av  a 2 s. c o m*/

    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;
}