public class KMeans extends Object implements Serializable
Constructor and Description |
---|
KMeans() |
Modifier and Type | Method and Description |
---|---|
org.apache.spark.api.java.JavaRDD<Integer> |
test(org.apache.spark.mllib.clustering.KMeansModel kMeansModel,
org.apache.spark.api.java.JavaRDD<org.apache.spark.mllib.linalg.Vector> data)
This method applies a kmeans model to a given dataset
|
org.apache.spark.mllib.clustering.KMeansModel |
train(org.apache.spark.api.java.JavaRDD<org.apache.spark.mllib.linalg.Vector> data,
int noOfClusters,
int noOfIterations)
This method trains a k-means clustering model - overload method with 3 parameters
|
org.apache.spark.mllib.clustering.KMeansModel |
train(org.apache.spark.api.java.JavaRDD<org.apache.spark.mllib.linalg.Vector> data,
int noOfClusters,
int noOfIterations,
int noOfRuns,
String initializationMode)
This method trains a k-means clustering model
|
public org.apache.spark.mllib.clustering.KMeansModel train(org.apache.spark.api.java.JavaRDD<org.apache.spark.mllib.linalg.Vector> data, int noOfClusters, int noOfIterations, int noOfRuns, String initializationMode)
data
- Training data as a JavaRDD of VectorsnoOfClusters
- Number of clustersnoOfIterations
- Number of iterations to runnoOfRuns
- Number of runs of the algorithm to execute in parallelinitializationMode
- Initialization algorithm: random or k-means||KMeansModel
objectpublic org.apache.spark.mllib.clustering.KMeansModel train(org.apache.spark.api.java.JavaRDD<org.apache.spark.mllib.linalg.Vector> data, int noOfClusters, int noOfIterations)
data
- Training data as a JavaRDD of VectorsnoOfClusters
- Number of clustersnoOfIterations
- Number of iterations to runKMeansModel
objectpublic org.apache.spark.api.java.JavaRDD<Integer> test(org.apache.spark.mllib.clustering.KMeansModel kMeansModel, org.apache.spark.api.java.JavaRDD<org.apache.spark.mllib.linalg.Vector> data)
kMeansModel
- KMeans modeldata
- JavaRDD containing feature vectorsCopyright © 2015 WSO2, Inc.. All Rights Reserved.