stream <- DSD_Gaussians(k = 3, d = 3, noise = 0.05)
## Example 1: Plot data
plot(stream)
## Example 2: Plot a clustering
dstream <- DSC_DStream(gridsize = 0.1)
update(dstream, stream, 500)
dstream
plot(dstream, stream)
## plot micro or macro-clusters only
plot(dstream, stream, type = "micro")
plot(dstream, stream, type = "macro")
## plot projected on the first two principal components
## and on dimensions 2 and 3
plot(dstream, stream, method = "pca")
plot(dstream, stream, dim = c(2, 3))
## D-Stream has a special implementation to show assignment areas
plot(dstream, stream, assignment = TRUE)
## Example 4: Use a custom transformation for plotting.
## We fit PCA using 100 points and create a transformation
## function to project the stream to the first two PCs.
pr <- princomp(get_points(stream, n = 100, info = FALSE))
trans <- function(x) predict(pr, x)[, 1:2 , drop = FALSE]
trans(get_points(stream, n = 3))
plot(dstream, stream, transform = trans)
Run the code above in your browser using DataLab