initial.Centers: Calculation of initial clusters centers for k-means like...

View source: R/cluster.Sim.r

initial.CentersR Documentation

Calculation of initial clusters centers for k-means like alghoritms

Description

Function calculates initial clusters centers for k-means like alghoritms with the following alghoritm (similar to SPSS QuickCluster function)

(a) if the distance between x_k and its closest cluster center is greater than the distance between the two closest centers (M_m and M_n ), then x_k replaces either M_m or M_n, whichever is closer to x_k.

(b) If x_k does not replace a cluster initial center in (a), a second test is made: If that distance d_q greater than the distance between M_q and its closest M_i, then x_k replaces M_q.

where:

M_i - initial center of i-th cluster

x_k - vector of k-th observation

d(...,...) - Euclidean distance

d_{mn} = min_{ij} d(M_i,M_j)

d_q = min_i d(x_k,M_i)

Usage

initial.Centers(x, k)

Arguments

x

matrix or dataset

k

number of initial cluster centers

Value

Numbers of objects choosen as initial cluster centers

Author(s)

Marek Walesiak marek.walesiak@ue.wroc.pl, Andrzej Dudek andrzej.dudek@ue.wroc.pl

Department of Econometrics and Computer Science, University of Economics, Wroclaw, Poland

References

Hartigan, J. (1975), Clustering algorithms, Wiley, New York. ISBN 0-471-35645-X.

See Also

cluster.Sim

Examples

#Example 1 (numbers of objects choosen as initial cluster centers)
library(clusterSim)
data(data_ratio)
ic <- initial.Centers(data_ratio, 10)
print(ic)

#Example 2 (application with kmeans algorithm)
library(clusterSim)
data(data_ratio)
kmeans(data_ratio,data_ratio[initial.Centers(data_ratio, 10),]) 


clusterSim documentation built on Sept. 30, 2024, 9:15 a.m.