Learn R Programming

stream (version 0.1-1)

DSD_Wrapper: A Data Stream Wrapper for Data Frames and Matrices)

Description

This class wraps either a data frame or matrix in memory and provides access to the data as a data stream. The data can either be looped or replayed manually to give the exact same data several times.

Usage

DSD_Wrapper(x, n, k=NA, loop=FALSE, assignment = NULL)

Arguments

x
A data frame or matrix with the data to be used in the stream. If x is a DSD object then a wrapper for n data points from this DSD is created.
n
Number of points used if x is a DSD object. If x is a data frame or matrix then n is ignored.
k
Optional: The number of clusters
loop
A flag that tells the stream to loop or not to loop over the data frame.
assignment
A flag that tells the stream to return assignment information.

Value

  • Returns a DSD_Wrapper object (subclass of DSD_R, DSD).

See Also

DSD, reset_stream

Examples

Run this code
dsd <- DSD_GaussianStatic(k=3, d=2)
d <- get_points(dsd, 500)
head(d)

# creating the DSD_Wrapper from d
replayer <- DSD_Wrapper(d, k=3)
replayer

# creating 2 clusterers of different algorithms
dsc1 <- DSC_CluStream()
dsc2 <- DSC_DenStream(initPoints=100)

# clustering the same data in 2 DSC objects
cluster(dsc1, replayer, 500)
reset_stream(replayer) # resetting the replayer to the first position
cluster(dsc2, replayer, 500)

Run the code above in your browser using DataLab