Skip to contents

This representation cannot perform clustering anymore, but it also does not need the supporting data structures. It only stores the cluster centers and weights.

Usage

DSC_Static(
  x,
  type = c("auto", "micro", "macro"),
  k_largest = NULL,
  min_weight = NULL
)

Arguments

x

The clustering (a DSD object) to copy or a list with components centers (a data frame or matrix) and weights (a vector with cluster weights).

type

which clustering to copy.

k_largest

only copy the k largest (highest weight) clusters.

min_weight

only copy clusters with a weight larger or equal to min_weight.

Value

An object of class DSC_Static (sub class of DSC, DSC_R). The list also contains either DSC_Micro or DSC_Macro depending on what type of clustering was copied.

Author

Michael Hahsler

Examples

stream <- DSD_Gaussians(k = 3, d = 2, noise = 0.05)

dstream <- DSC_DStream(gridsize = 0.05)
update(dstream, stream, 500)
dstream
#> D-Stream 
#> Class: DSC_DStream, DSC_Micro, DSC_R, DSC 
#> Number of micro-clusters: 31 
#> Number of macro-clusters: 3 
plot(dstream, stream)


# create a static copy of the clustering
static <- DSC_Static(dstream)
static
#> Static clustering 
#> Class: DSC_Static, DSC_Micro, DSC_R, DSC 
#> Number of micro-clusters: 31 
plot(static, stream)


# copy only the 5 largest clusters
static2 <- DSC_Static(dstream, k_largest = 5)
static2
#> Static clustering 
#> Class: DSC_Static, DSC_Micro, DSC_R, DSC 
#> Number of micro-clusters: 5 
plot(static2, stream)


# copy all clusters with a weight of at least .3
static3 <- DSC_Static(dstream, min_weight = .3)
static3
#> Static clustering 
#> Class: DSC_Static, DSC_Micro, DSC_R, DSC 
#> Number of micro-clusters: 31 
plot(static3, stream)


# create a manual clustering
static4 <- DSC_Static(list(
             centers = data.frame(X1 = c(1, 2), X2 = c(1, 2)),
             weights = c(1, 2)),
             type = "macro")
static4
#> Static clustering 
#> Class: DSC_Static, DSC_Macro, DSC_R, DSC 
#> Number of macro-clusters: 2 
plot(static4)