find_clusters

0th

Percentile

Find the EMM State/Cluster for an Observation

Finds the cluster and thus the EMM states for observations.

Keywords
models
Usage
"find_clusters"(x, newdata, match_cluster=c("exact", "nn"), dist = FALSE)
Arguments
x
an EMM object.
newdata
a matrix/data.frame with observations.
match_cluster
find exact or nearest neighbor (nn) cluster/state. If a number is supplied then the threshold times this number is used for exact matching.
dist
also report the distance to the chosen cluster/state (as a data.frame).
Value

Returns the name of the matching clusters/states or a data.frame with columns "state" and "dist" if dist=TRUE.

See Also

EMM and tNN

Aliases
  • find_clusters
  • find_clusters,tNN,numeric-method
  • find_clusters,tNN,matrix-method
  • find_clusters,tNN,data.frame-method
Examples
data("EMMTraffic")
emm <- EMM(measure="eJaccard", threshold=0.2)
emm <- build(emm, EMMTraffic)

find_clusters(emm, EMMTraffic)
find_clusters(emm, EMMTraffic, dist=TRUE)

## add noise to the data 
set.seed(1234)
newdata <- sapply(EMMTraffic, jitter, amount=15)
## default is exact match
find_clusters(emm, newdata, dist=TRUE)
## match with nearest neighbor
find_clusters(emm, newdata, match_cluster="nn", dist=TRUE)
## exact match only if within .5 times threshold
find_clusters(emm, newdata, match_cluster=.5, dist=TRUE)
## exact match only if within 2 times threshold
find_clusters(emm, newdata, match_cluster=2, dist=TRUE)
Documentation reproduced from package rEMM, version 1.0-11, License: GPL-2

Community examples

Looks like there are no examples yet.