List of usage examples for org.apache.mahout.clustering.canopy Canopy getId
@Override public int getId()
From source file:edu.indiana.d2i.htrc.kmeans.MemKMeansUtil.java
License:Apache License
/** Configure the mapper with the cluster info */ public static void configureWithClusterInfo(Configuration conf, Path clusterPath, Collection<Cluster> clusters) { for (Writable value : new SequenceFileDirValueIterable<Writable>(clusterPath, PathType.LIST, PathFilters.partFilter(), conf)) { Class<? extends Writable> valueClass = value.getClass(); if (valueClass.equals(Cluster.class)) { // get the cluster info clusters.add((Cluster) value); } else if (valueClass.equals(Canopy.class)) { // get the cluster info Canopy canopy = (Canopy) value; clusters.add(new Cluster(canopy.getCenter(), canopy.getId(), canopy.getMeasure())); } else {/*from ww w .ja v a 2 s . c o m*/ throw new IllegalStateException("Bad value class: " + valueClass); } } }