Learn R Programming

stream (version 2.0-1)

animate_cluster: Animates Plots of the Clustering Process

Description

Generates an animation of a data stream clustering process.

Usage

animate_cluster(
  dsc,
  dsd,
  measure = NULL,
  horizon = 100,
  n = 1000,
  type = c("auto", "micro", "macro"),
  assign = "micro",
  assignmentMethod = c("auto", "model", "nn"),
  excludeNoise = FALSE,
  wait = 0.1,
  plot.args = NULL,
  ...
)

Arguments

dsc

a DSC

dsd

a DSD

measure

the evaluation measure that should be graphed below the animation (see evaluate_stream().)

horizon

the number of points displayed at once/used for evaluation.

n

the number of points to be plotted

type, assign, assignmentMethod, excludeNoise

are passed on to evaluate_stream() to calculate the evaluation measure.

wait

the time interval between each frame

plot.args

a list with plotting parameters for the clusters.

...

extra arguments are added to plot.args.

Author

Michael Hahsler

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).

Note: You need to install package animation and its system requirements.

See Also

animation::ani.replay() for replaying and saving animations.

Other DSC: DSC_Macro(), DSC_Micro(), DSC_R(), DSC_SlidingWindow(), DSC_Static(), DSC_TwoStage(), DSC(), evaluate.DSC, get_assignment(), plot.DSC(), predict(), prune_clusters(), read_saveDSC, recluster()

Other plot: animate_data(), plot.DSC(), plot.DSD()

Other evaluation: evaluate.DSC, evaluate

Examples

Run this code
if (interactive()) {
stream <- DSD_Benchmark(1)

### animate the clustering process with evaluation
### Note: we choose to exclude noise points from the evaluation
###       measure calculation, even if the algorithm would assign
###       them to a cluster.
dbstream <- DSC_DBSTREAM(r = .04, lambda = .1, gaptime = 100, Cm = 3,
  shared_density = TRUE, alpha = .2)

animate_cluster(dbstream, stream, horizon = 100, n = 5000,
  measure = "crand", type = "macro", assign = "micro",
  plot.args = list(xlim = c(0, 1), ylim = c(0, 1), shared = TRUE))
}

Run the code above in your browser using DataLab