Example usage for org.apache.mahout.clustering.streaming.mapreduce CentroidWritable getCentroid

List of usage examples for org.apache.mahout.clustering.streaming.mapreduce CentroidWritable getCentroid

Introduction

In this page you can find the example usage for org.apache.mahout.clustering.streaming.mapreduce CentroidWritable getCentroid.

Prototype

public Centroid getCentroid() 

Source Link

Usage

From source file:org.conan.mymahout.clustering.streaming.tools.IOUtils.java

License:Apache License

/**
 * Converts CentroidWritable values in a sequence file into Centroids lazily.
 * @param dirIterable the source iterable (comes from a SequenceFileDirIterable).
 * @return an Iterable<Centroid> with the converted vectors.
 *//*from   w  ww  .j av  a  2 s.com*/
public static Iterable<Centroid> getCentroidsFromCentroidWritableIterable(
        Iterable<CentroidWritable> dirIterable) {
    return Iterables.transform(dirIterable, new Function<CentroidWritable, Centroid>() {
        @Override
        public Centroid apply(CentroidWritable input) {
            Preconditions.checkNotNull(input);
            return input.getCentroid().clone();
        }
    });
}