Skip to contents

Determine cluster centers using the uniform distribution, taking into account the number of clusters (num_clusters) and the average cluster separation (clu_sep).

More specifically, let \(c=\)num_clusters, \(\mathbf{s}=\)clu_sep, \(\mathbf{o}=\)clu_offset, \(n=\)length(clu_sep) (i.e., number of dimensions). Cluster centers are obtained according to the following equation:

\[\mathbf{C}=c\mathbf{U}\cdot\operatorname{diag}(\mathbf{s}) + \mathbf{1}\,\mathbf{o}^T\]

where \(\mathbf{C}\) is the \(c \times n\) matrix of cluster centers, \(\mathbf{U}\) is an \(c \times n\) matrix of random values drawn from the uniform distribution between -0.5 and 0.5, and \(\mathbf{1}\) is an \(c \times 1\) vector with all entries equal to 1.

Usage

clucenters(num_clusters, clu_sep, clu_offset)

Arguments

num_clusters

Number of clusters.

clu_sep

Average cluster separation (\(n \times 1\) vector).

clu_offset

Cluster offsets (\(n \times 1\) vector).

Value

A \(c \times n\) matrix containing the cluster centers.

Note

This function is stochastic. For reproducibility set a PRNG seed with set.seed.

Examples

set.seed(321)
clucenters(3, c(30, 10), c(-50,50))
#>            [,1]     [,2]
#> [1,]  -8.969561 42.65221
#> [2,] -10.644303 46.71536
#> [3,] -73.560159 45.23540