| DSD_MG | R Documentation |
Creates an evolving data stream generator from a list of Moving Generator Clusters (MGCs), each representing one cluster that can be static or change over time.
DSD_MG(dimension = 2, ..., labels = NULL, description = NULL)
add_cluster(x, c, label = NULL)
get_clusters(x)
remove_cluster(x, i)
## S3 method for class 'DSD_MG'
add_cluster(x, c, label = NULL)
dimension |
the dimension of the DSD object. All MGCs added to the stream need to have the same dimensionality. |
... |
initial set of MGCs. |
description |
An optional string used by |
x |
A |
c |
The cluster (MGC) that should be added to the |
label, labels |
integer representing the cluster label. |
i |
The index of the cluster that should be removed from the
|
DSD_MG is able to generate complex data streams with known ground truth
that evolve over a period of time: clusters can move, grow, shrink, appear,
disappear, split or merge. The behavior of the stream is determined by its
components, the MGCs. See MGC for the available components, how
density and generator time work, and how to define cluster shapes.
Each point is returned with a .class column containing the label of the
component that produced it. By default, each component gets a new integer
label. Several components can share a label to form one ground-truth
cluster (e.g., to create non-convex clusters). Noise components
(MGC_Noise) get the label NA unless a label is specified.
The generator can be modified after it was created: add_cluster() adds a
component, remove_cluster() removes the component with a given index in
the list returned by get_clusters(). reset_stream() sets the generator
time back (to 1 by default). Note that streams and components are mutable
objects. Modifying a component also affects every stream that contains it.
DSD_MG() returns a DSD_MG object (a DSD). add_cluster() and
remove_cluster() modify and invisibly return the stream, and
get_clusters() returns the list of MGC components.
Matthew Bolanos
MGC for types of moving clusters.
Other DSD:
DSD(),
DSD_BarsAndGaussians(),
DSD_Benchmark(),
DSD_Cubes(),
DSD_Gaussians(),
DSD_Memory(),
DSD_Mixture(),
DSD_NULL(),
DSD_ReadDB(),
DSD_ReadStream(),
DSD_Target(),
DSD_UniformNoise(),
DSD_mlbenchData(),
DSD_mlbenchGenerator(),
DSF(),
animate_data(),
close_stream(),
get_points(),
plot.DSD(),
reset_stream()
### create an empty DSD_MG
stream <- DSD_MG(dimension = 2)
stream
### add two clusters
c1 <- MGC_Random(density = 50, center = c(50, 50), parameter = 1)
add_cluster(stream, c1)
stream
c2 <- MGC_Noise(density = 1, range = rbind(c(-20, 120), c(-20, 120)))
add_cluster(stream, c2)
stream
get_clusters(stream)
get_points(stream, n = 5)
plot(stream, xlim = c(-20,120), ylim = c(-20, 120))
if (interactive()) {
animate_data(stream, n = 5000, xlim = c(-20, 120), ylim = c(-20, 120))
}
### remove cluster 1
remove_cluster(stream, 1)
stream
get_clusters(stream)
plot(stream, xlim = c(-20, 120), ylim = c(-20, 120))
### create a more complicated cluster structure (using 2 clusters with the same
### label to form an L shape)
stream <- DSD_MG(dimension = 2,
MGC_Static(density = 10, center = c(.5, .2), parameter = c(.4, .2),
shape = Shape_Block),
MGC_Static(density = 10, center = c(.6, .5), parameter = c(.2, .4),
shape = Shape_Block),
MGC_Static(density = 5, center = c(.39, .53), parameter = c(.16, .35),
shape = Shape_Block),
MGC_Noise( density = 1, range = rbind(c(0,1), c(0,1))),
labels = c(1, 1, 2, NA)
)
stream
plot(stream, xlim = c(0, 1), ylim = c(0, 1))
### simulate the clustering of a splitting cluster
c1 <- MGC_Linear(dimension = 2, keyframelist = list(
keyframe(time = 1, density = 20, center = c(0,0), parameter = 10),
keyframe(time = 50, density = 10, center = c(50,50), parameter = 10),
keyframe(time = 100,density = 10, center = c(50,100),parameter = 10)
))
### Note: The second cluster appears at time = 50
c2 <- MGC_Linear(dimension = 2, keyframelist = list(
keyframe(time = 50, density = 10, center = c(50,50), parameter = 10),
keyframe(time = 100,density = 10, center = c(100,50),parameter = 10)
))
stream <- DSD_MG(dimension = 2, c1, c2)
stream
dbstream <- DSC_DBSTREAM(r = 20, lambda = 0.1)
if (interactive()) {
purity <- animate_cluster(dbstream, stream, n = 2500, type = "micro",
xlim = c(-10, 120), ylim = c(-10, 120),
measure = "purity", horizon = 100)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.