public final class StreamingKMeansUtilsMR extends Object
Modifier and Type | Method and Description |
---|---|
static Iterable<Centroid> |
castVectorsToCentroids(Iterable<Vector> input)
Returns an Iterable of Centroid from an Iterable of Vector by either casting each Vector to Centroid (if the
instance extends Centroid) or create a new Centroid based on that Vector.
|
static Iterable<Centroid> |
getCentroidsFromVectorWritable(Iterable<VectorWritable> inputIterable)
Returns an Iterable of centroids from an Iterable of VectorWritables by creating a new Centroid containing
a RandomAccessSparseVector as a delegate for each VectorWritable.
|
static UpdatableSearcher |
searcherFromConfiguration(org.apache.hadoop.conf.Configuration conf)
Instantiates a searcher from a given configuration.
|
static void |
writeCentroidsToSequenceFile(Iterable<Centroid> centroids,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration conf)
Writes centroids to a sequence file.
|
static void |
writeVectorsToSequenceFile(Iterable<? extends Vector> datapoints,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration conf) |
public static UpdatableSearcher searcherFromConfiguration(org.apache.hadoop.conf.Configuration conf)
conf
- the configurationRuntimeException
- if the distance measure class cannot be instantiatedIllegalStateException
- if an unknown searcher class was requestedpublic static Iterable<Centroid> getCentroidsFromVectorWritable(Iterable<VectorWritable> inputIterable)
inputIterable
- VectorWritable Iterable to get Centroids frompublic static Iterable<Centroid> castVectorsToCentroids(Iterable<Vector> input)
input
- Iterable of Vectors to castpublic static void writeCentroidsToSequenceFile(Iterable<Centroid> centroids, org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf) throws IOException
centroids
- the centroids to write.path
- the path of the output file.conf
- the configuration for the HDFS to write the file to.IOException
public static void writeVectorsToSequenceFile(Iterable<? extends Vector> datapoints, org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.