Learn R Programming

stream (version 0.1-1)

DSC_Kmeans: Kmeans Macro-clusterer

Description

Class implements the k-means algorithm for reclustering micro-clusterings.

Usage

DSC_Kmeans(k, weighted = TRUE, iter.max = 10, nstart = 1,
	    algorithm = c("Hartigan-Wong", "Lloyd", "Forgy", "MacQueen"))

Arguments

k
either the number of clusters, say k, or a set of initial (distinct) cluster centers. If a number, a random set of (distinct) rows in x is chosen as the initial centers.
weighted
use a weighted k-means (algorithm is ignored).
iter.max
the maximum number of iterations allowed.
nstart
if centers is a number, how many random sets should be chosen?
algorithm
character: may be abbreviated.

Value

  • An object of class DSC_Kmeans (subclass of DSC, DSC_R, DSC_Macro)

Details

Please refer to function kmeans in stats for more details on the algorithm.

See Also

DSC, DSC_Macro

Examples

Run this code
# 3 clusters with 5% noise
dsd <- DSD_GaussianStatic(k=3, noise=0)

dsc <- DSC_BIRCH(radius=0.01)
cluster(dsc, dsd, 500)

# recluster micro-clusters
kmeans <- DSC_Kmeans(k=3)
recluster(kmeans, dsc)
plot(kmeans, dsd)

# Kmeans can also directly cluster data (original data are considered 
# micro-cluster centers)
kmeans <- DSC_Kmeans(k=3)
cluster(kmeans, dsd, 500)
plot(kmeans, dsd)

Run the code above in your browser using DataLab