DSC_EMM: DSC Interface for EMM and tNN (package stream)

View source: R/DSC_EMM.R

DSC_EMMR Documentation

DSC Interface for EMM and tNN (package stream)

Description

Provides Data Stream Clusterer (DSC) interfaces for EMM and tNN so they can be used in the stream framework.

Usage

DSC_EMM(formula = NULL, threshold = 0.2, measure = "euclidean", distFun = NULL,
    centroids = identical(tolower(measure), "euclidean"),
    lambda = 0)

DSC_tNN(formula = NULL, threshold = 0.2, measure = "euclidean",
    centroids = identical(tolower(measure), "euclidean"), lambda = 0)

get_EMM(dsc)
set_EMM(dsc, x)

Arguments

formula

NULL to use all features in the stream or a model formula of the form ~ X1 + X2 to specify the features used for clustering. Only ., + and - are currently supported in the formula.

threshold

A "numeric" with the dissimilarity threshold used by the clustering algorithm for assigning a new observation to existing clusters.

measure

A "character" containing the name of the dissimilarity measure used (see dist in proxy for available measures).

distFun

Specify a function passed on as method to dist in proxy (see dist in proxy). The character string passed on as measure will be used as the measure's name.

centroids

A "logical" indicating if centroids are used for clusters. If FALSE, pseudo medians (first observation of a cluster) are used to represent a cluster.

lambda

A "numeric" specifying the rate for fading.

dsc

an object of class "DSC_EMM".

x

an object of class "EMM"

Details

DSC_tNN and DSC_EMM wrap the clustering algorithms so they can be used with the stream framework. See DSC for details.

get_EMM() and set_EMM() can be used to access the EMM object inside the DSC_EMM object.

Value

An object of class "DSC_EMM" or "DSC_tNN".

Examples

library(stream)

### tNN clustering example

stream <- DSD_Gaussians()
stream

cl <- DSC_tNN(threshold = .1)
cl

update(cl, stream, 100)
cl

get_centers(cl)
get_weights(cl)

plot(cl, stream)

## EMM clustering example
data("EMMsim")
plot(EMMsim_train, pch = NA)
lines(EMMsim_train, col = "gray")
points(EMMsim_train, pch = EMMsim_sequence_train)

stream <- DSD_Memory(EMMsim_train)
stream

cl <- DSC_EMM(threshold = 0.1, measure = "euclidean", lambda = .1)
update(cl, stream, n = 200)
cl

reset_stream(stream)
plot(cl, stream, n = 200, method = "pca")

# inspect and recluster the EMM in the DSC_EMM object
emm <- get_EMM(cl)
plot(emm)

emm <- recluster_hclust(emm, k = 4, method = "average")
plot(emm)

set_EMM(cl, emm)

reset_stream(stream)
plot(cl, stream, n = 200, method = "pca")

rEMM documentation built on May 29, 2024, 4:35 a.m.