Example usage for org.apache.mahout.clustering.canopy Canopy getMeasure

List of usage examples for org.apache.mahout.clustering.canopy Canopy getMeasure

Introduction

In this page you can find the example usage for org.apache.mahout.clustering.canopy Canopy getMeasure.

Prototype

public DistanceMeasure getMeasure() 

Source Link

Usage

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 {/*  w  w  w . jav a  2  s.  c o  m*/
            throw new IllegalStateException("Bad value class: " + valueClass);
        }
    }
}