Learn R Programming

CEC (version 0.9.3)

init.centers: Center initialization

Description

Creates a matrix of k points (centers) based on a given matrix of points. One of two method can be used: Kmeans++ centers initialization method or a random choice of data points.

Usage

init.centers(x, k, method = c("kmeans++", "random"))

Arguments

x
Dataset as a matrix of n-dimensional points.
k
Number of points (centers) to generate.
method
Generation method. Possible values are: "kmeans++", "random.points".

Value

  • Matrix points (centers) with k rows.

Examples

Run this code
m = matrix(runif(3000), 1000, 3)
init.centers(m, 3, method = "km")

Run the code above in your browser using DataLab