Learn R Programming

stream (version 0.1-1)

DSC_Sample: Extract a Fixed-size Sample from a Data Stream

Description

Extracts a sample form a data stream using Reservoir Sampling. The sample is stored as a set of micro-clusters to be compatible with other data DSC stream clustering algorithms.

Usage

DSC_Sample(k = 100)

Arguments

k
the number of points to be sampled from the stream.

Value

  • An object of class DSC_Sample (subclass of DSC, DSC_R, DSC_Micro).

References

Vitter, J. S. (1985): Random sampling with a reservoir. ACM Transactions on Mathematical Software, 11(1), 37-57.

See Also

DSC, DSC_Micro

Examples

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

dsc <- DSC_Sample(20)
cluster(dsc, dsd, 500)
dsc

# plot micro-clusters
plot(dsc, dsd)

# reclustering (Kmeans is sufficient because DSC_Sample does not return weights)
kmeans <- DSC_Kmeans(3)
recluster(kmeans,dsc)
plot(kmeans,dsd)

Run the code above in your browser using DataLab