Learn R Programming

rEMM (version 0.1-2)

prune: Prune States and/or Transitions

Description

Simplifies an EMM and/or the clustering by removing all clusters/states and/or transitions which have a count smaller than a given threshold.

Usage

## S3 method for class 'EMM':
prune(x, count_threshold, states = TRUE, transitions = TRUE)

rare_states(x, count_threshold, ...) rare_transitions(x, count_threshold, ...)

Arguments

x
an object of class "EMM".
count_threshold
all states/edges with a count below the threshold are removed from the model.
states
prune states?
transitions
prune transitions?
...
further arguments (currently not used).

Value

  • prune returns an object of class EMM. rare_states returns a vector of names of rare states/clusters. rare_transitions returns a data.frame of rare transitions.

See Also

remove

Examples

Run this code
data("EMMTraffic")

## For the example we use a very high learning rate
emm_l <- EMM(measure="eJaccard", threshold=0.2, lambda = 1)
emm_l <- build(emm_l, EMMTraffic)

## show state counts and transition counts
state_counts(emm_l)
transition_matrix(emm_l, type="counts")

## remove all states and edges with a threshold of 0.1
rare_states(emm_l, count_threshold=0.1)
rare_transitions(emm_l, count_threshold=0.1)
emm_lr <- prune(emm_l, count_threshold=0.1)

## compare graphs
op <- par(mfrow = c(1, 2), pty = "m")
plot(emm_l, method = "graph", main = "EMM with high learning rate")
plot(emm_lr, method = "graph", main = "Simplified EMM")
par(op)

Run the code above in your browser using DataLab