clusterCount: The number of clusters to form as well as the number of centroids to generate.
maximumIterationCount: Maximum number of iterations of the k-means algorithm for a single run.
initializer: Method for cluster initialization.
seed: Initialize a pseudo-random number generator for "kmeans++".
Method for cluster initialization.
"kmeans++": Heuristic Initialization of centroids.
"random": Random Initialization of centroids.
API Methods
fit(data: Tensor): Fit a KMeans cluster.
prediction(for: Tensor): Predict the closest cluster given sample belongs.
score(): Returns the sum of squared distances of samples to their closest cluster center.
transformation(for: Tensor): Transform input to a cluster-distance space.
fitAndPrediction(for: Tensor): Compute cluster centers and predict the closest cluster given sample belongs.
fitAndTransformation(for: Tensor): Compute cluster centers and transform input to a cluster-distance space.
KMeans Clustering
KMeans(clusterCount: 2, maximumIterationCount: 300, initializer: "kmean++", seed: 0)
"kmeans++"
.Method for cluster initialization.
"kmeans++"
: Heuristic Initialization of centroids."random"
: Random Initialization of centroids.API Methods
fit(data: Tensor)
: Fit a KMeans cluster.prediction(for: Tensor)
: Predict the closest cluster given sample belongs.score()
: Returns the sum of squared distances of samples to their closest cluster center.transformation(for: Tensor)
: Transform input to a cluster-distance space.fitAndPrediction(for: Tensor)
: Compute cluster centers and predict the closest cluster given sample belongs.fitAndTransformation(for: Tensor)
: Compute cluster centers and transform input to a cluster-distance space.References