pyspark.mllib.clustering.
KMeans
K-means clustering.
New in version 0.9.0.
Methods
train(rdd, k[, maxIterations, …])
train
Train a k-means clustering model.
Methods Documentation
pyspark.RDD
Training points as an RDD of pyspark.mllib.linalg.Vector or convertible sequence types.
pyspark.mllib.linalg.Vector
Number of clusters to create.
Maximum number of iterations allowed. (default: 100)
The initialization algorithm. This can be either “random” or “k-means||”. (default: “k-means||”)
Random seed value for cluster initialization. Set as None to generate seed based on system time. (default: None)
Number of steps for the k-means|| initialization mode. This is an advanced setting – the default of 2 is almost always enough. (default: 2)
Distance threshold within which a center will be considered to have converged. If all centers move less than this Euclidean distance, iterations are stopped. (default: 1e-4)
KMeansModel
Initial cluster centers can be provided as a KMeansModel object rather than using the random or k-means|| initializationModel. (default: None)