microToMacro: Translate Micro-cluster IDs to Macro-cluster IDs

Description Usage Arguments Value Author(s) See Also Examples

View source: R/DSC_Macro.R

Description

Translates micro-cluster ids into macro-cluster ids for a DSC_Macro object.

Usage

1
microToMacro(x, micro=NULL)

Arguments

x

a DSC_Macro object that also contains information about micro-clusters.

micro

A vector with micro-cluster ids. If NULL then the assignments for all micro-clusters in x are returned.

Value

A vector of the same length as micro with the macro-cluster ids.

Author(s)

Michael Hahsler

See Also

DSC_Macro

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
stream <- DSD_Gaussians(k=3, d=2, noise=0.05, p=c(.2,.4,.6))

# recluster a micro-clusters
micro <- DSC_DStream(gridsize=0.05)
update(micro, stream, 500)

macro <- DSC_Kmeans(k=3)
recluster(macro, micro)

# translate all micro-cluster ids
microToMacro(macro)

# plot some data points in gray
plot(stream, col="gray", cex=.5, xlim=c(0,1), ylim=c(0,1))
# add micro-clusters and use the macro-cluster ids as color and weights as size
points(get_centers(macro, type="micro"), 
  col=microToMacro(macro), 
  cex=get_weights(macro, type="micro", scale=c(.5,3)))
# add macro-cluster centers (size is weight)
points(get_centers(macro, type="macro"), 
  cex = get_weights(macro, type="macro", scale=c(2,5)),
  pch=3,lwd=3, col=1:3)

stream documentation built on June 2, 2018, 9:08 a.m.