stream (version 1.3-0)

DSC_Kmeans: Kmeans Macro-clusterer

Description

Class implements the k-means algorithm for reclustering a set of micro-clusters.

Usage

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

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.

min_weight

micro-clusters with a weight less than this will be ignored for reclustering.

description

optional character string to describe the clustering method.

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.

Note that this clustering cannot be updated iteratively and every time it is used for (re)clustering, the old clustering is deleted.

See Also

DSC, DSC_Macro

Examples

Run this code
# NOT RUN {
stream <- DSD_Gaussians(k=3, noise=0)

# create micro-clusters via sampling
sample <- DSC_Sample(k=20)
update(sample, stream, 500)
sample
  
# recluster micro-clusters
kmeans <- DSC_Kmeans(k=3)
recluster(kmeans, sample)
plot(kmeans, stream, type="both")

# For comparison we use k-means directly to cluster data
# Note: k-means is not a data stream clustering algorithm
kmeans <- DSC_Kmeans(k=3)
update(kmeans, stream, 500)
plot(kmeans, stream)
# }

Run the code above in your browser using DataLab