Learn R Programming

stream (version 1.0-3)

animation: Animates the plotting of a DSD and the clustering process

Description

Generates an animation of a data stream or a data steam clustering.

Usage

animate_data(dsd, n=1000, wait=.1, horizon=100, ...)
animate_cluster(dsc, dsd, macro=NULL, n=1000, wait=.1, horizon=100, 
    evaluationMeasure=NULL, evaluationType="auto", evaluationAssign="micro", 
    evaluationAssignmentMethod = "auto", ...)

Arguments

dsd
a DSD object
dsc
a DSC object
macro
a DSC_macro object used for reclustering when performing evaluations.
n
the number of points to be plotted
wait
the time interval between each frame
horizon
the number of points displayed at once/used for evaluation.
evaluationMeasure
the evaluation measure that should be graphed below the animation
evaluationType
evaluate "micro" or "macro"-clusters? "auto" chooses micro if dsc is of class DSC_micro and no macro is given. Otherwise macro is used.
evaluationAssign
assign new points to the closest "micro" or "macro"-cluster to calculate the evaluation measure.
evaluationAssignmentMethod
how to assign data points to micro-clusters. Options are "model" and "nn" (nearest neighbor). "auto" uses model if available and nn otherwise.
...
extra arguments for plot.

Details

Animations are recorded using the library animation and can be replayed (which gives a smoother experience since the is no more computation done) and saved in various formats (see Examples section below).

See Also

evaluate_cluster for stream evaluation without animation. See ani.replay for replaying and saving animations.

Examples

Run this code
dsd <- DSD_Benchmark(1)
animate_data(dsd, n=5000,  xlim=c(0,1), ylim=c(0,1), horizon=100)

### animations can be replayed with the animation package
library(animation)
animation::ani.options(interval=.1) ## change speed
ani.replay()
  
### animations can also be saved as HTML, animated gifs, etc.
saveHTML(ani.replay())  
  
### animate the clustering process with evaluation
reset_stream(dsd)
dsc <- DSC_tNN(r=.1, lambda=.01, shared_density=TRUE,
  alpha=.2, noise=.1)  

animate_cluster(dsc, dsd, n=5000, horizon=100, 
  evaluationMeasure="crand", evaluationType="macro", evaluationAssign="micro",
  xlim=c(0,1),ylim=c(0,1), type="shared")

Run the code above in your browser using DataLab