org.apache.mahout.utils.clustering
Class JsonClusterWriter
java.lang.Object
org.apache.mahout.utils.clustering.AbstractClusterWriter
org.apache.mahout.utils.clustering.JsonClusterWriter
- All Implemented Interfaces:
- Closeable, ClusterWriter
public class JsonClusterWriter
- extends AbstractClusterWriter
Dump cluster info to JSON formatted lines. Heavily inspired by
ClusterDumperWriter.java and CSVClusterWriter.java
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JsonClusterWriter
public JsonClusterWriter(Writer writer,
Map<Integer,List<WeightedPropertyVectorWritable>> clusterIdToPoints,
DistanceMeasure measure,
int numTopFeatures,
String[] dictionary)
write
public void write(ClusterWritable clusterWritable)
throws IOException
- Generate HashMap with cluster info and write as a single JSON formatted
line
- Throws:
IOException
getTopFeaturesList
public List<Object> getTopFeaturesList(Vector vector,
String[] dictionary,
int numTerms)
- Create a List of HashMaps containing top terms information
- Returns:
- List
getPoints
public List<Object> getPoints(Cluster cluster,
String[] dictionary)
- Create a List of HashMaps containing Vector point information
- Returns:
- List
Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.