cuml_kmeans: Run the K means clustering algorithm.

Description Usage Arguments Value Examples

View source: R/kmeans.R

Description

Run the K means clustering algorithm.

Usage

1
cuml_kmeans(x, k, max_iters = 300)

Arguments

x

The input matrix or dataframe. Each data point should be a row and should consist of numeric values only.

k

The number of clusters.

max_iters

Maximum number of iterations (default: 300).

Value

A list containing the cluster assignments and the centroid of each cluster. Each centroid will be a column within the 'centroids' matrix.

Examples

1
2
3
4
5
6
7
8
9
library(cuml4r)

kclust <- cuml_kmeans(
  iris[, which(names(iris) != "Species")],
  k = 3,
  max_iters = 100
)

print(kclust)

cuml4r documentation built on July 26, 2021, 9:06 a.m.

Related to cuml_kmeans in cuml4r...