kmpp: k-means++

Description Usage Arguments Value Examples

View source: R/kpodclustr-package.r

Description

kmpp Computes initial centroids via kmeans++

Usage

1
kmpp(X, k)

Arguments

X

Data matrix whose rows are observations and columns are features

k

Number of clusters.

Value

A data matrix whose rows contain initial centroids for the k clusters

Examples

1
2
3
4
5
n <- 10
p <- 2
X <- matrix(rnorm(n*p),n,p)
k <- 3
kmpp(X,k)

Example output

Loading required package: clues
           [,1]       [,2]
[1,]  0.8221974  0.4154228
[2,]  1.5216972 -2.5867701
[3,] -0.8873031  0.1523562

kpodclustr documentation built on May 30, 2017, 5:10 a.m.