Learn R Programming

stream (version 1.5-1)

DSC: Data Stream Clusterer Base Classes

Description

Abstract base classes for all DSC (Data Stream Clusterer) and DSC_R classes. Concrete implementations are functions starting with DSC_ (R Studio use auto-completion with Tab to select one).

Usage

DSC(...)

get_centers(x, type = c("auto", "micro", "macro"), ...)

get_weights(x, type = c("auto", "micro", "macro"), scale = NULL, ...)

get_copy(x)

get_microclusters(x, ...)

get_macroclusters(x, ...)

get_microweights(x, ...)

get_macroweights(x, ...)

nclusters(x, type = c("auto", "micro", "macro"), ...)

Arguments

...

further parameter

x

a DSC object.

type

Return weights of micro- or macro-clusters in x. Auto uses the class of x to decide.

scale

a range (from, to) to scale the weights. Returns by default the raw weights.

Functions

  • get_centers: Gets the cluster centers (micro- or macro-clusters) from a DSC object.

  • get_weights: Get the weights of the clusters in the DSC (returns 1s if not implemented by the clusterer)

  • get_copy: Create a Deep Copy of a DSC Object that contain reference classes (e.g., Java data structures for MOA).

  • get_microclusters: Get micro-clusters if the object is a DSC_Micro.

  • get_macroclusters: Get micro-clusters if the the object is a DSC_Macro.

  • get_microweights: Get micro-cluster weights if the object is a DSC_Micro.

  • get_macroweights: Get macro-cluster weights if the object is a DSC_Macro.

  • nclusters: Returns the number of micro-clusters from the DSC object.

Author

Michael Hahsler

Details

The DSC} and DSC_Rclasses cannot be instantiated (callingDSC()orDSC_R()` produces only a message listing the available implementations), but they serve as a base class from which other DSC classes inherit.

Class DSC provides several generic functions that can operate on all DSC subclasses. See Functions section below. Additional, separately documented functions are:

  • update Add new data points from a stream to a clustering.

  • plot function is also provides for DSC.

  • get_assignment Find out what cluster new data points would be assigned to.

get_centers and get_weights are typically overwritten by subclasses of DSC. DSC_R provides these functions for R-based DSC implementations.

Since DSC objects often contain external pointers, regular saving and reading operations will fail. Use saveDSC and readDSC which will serialize the objects first appropriately.

See Also

DSC_Micro, DSC_Macro, animate_cluster, update, evaluate, get_assignment, microToMacro, plot, prune_clusters, recluster, readDSC, saveDSC

Examples

Run this code

DSC()

stream <- DSD_Gaussians(k=3, d=2)
dstream <- DSC_DStream(gridsize=.1)
update(dstream, stream, 500)
dstream

# get micro-cluster centers
get_centers(dstream)

# get the number of clusters
nclusters(dstream)

# get the micro-cluster weights
get_weights(dstream)

# D-Stream also has macro-clusters
get_weights(dstream, type="macro")


Run the code above in your browser using DataLab