as.dendrogram.hdbscan: as.dendrogram.hdbscan

Description Usage Arguments Value Note Examples

View source: R/dendrogram.R

Description

Convert an hdbscan object into a dendrogram compatible with the stats package.

Usage

1
2
## S3 method for class 'hdbscan'
as.dendrogram(object, includeNodes = FALSE, ...)

Arguments

object

An hdbscan object.

includeNodes

Whether individual nodes should be included in the dedrogram. Can cause a substantial increase in the size of the object.

...

For compatibility with as.dendrogram, and currently ignored.

Value

A dendrogram object, where nodes have the following attributes:

'leaf'

As in dendrogram.

'members'

As in dendrogram.

'size'

The number of nodes underneath the cluster.

'height'

The core distance at which the cluster or node was merged.

'probability'

The probability that the leaf is a true member of its assigned cluster.

'GLOSH'

The leaf's GLOSH outlier score.

'stability'

The node's determined stability, taking into account child-node stabilities. Missing for leaves.

'selected'

Whether the node was selected as a cluster. Missing for leaves. Note that when a node is selected, all points under child branches are assigned to the same cluster.

'cluster'

The cluster number, for reference against the hdbscan object.

Note

The hdbscan algorithm works by first building a hierarchy based on a minimal spanning tree, then consolidating nodes according to rules in the algorithm. The algorithm then selects some of the consolidated nodes as clusters, deselecting others. For example, if Node A has children B and C, the algorithm might select A, and then all points under A, B, and C would be assigned to the same cluster. Or, it might deselect A, and select B and C instead. In that case, the nodes under B would be assigned to one cluster, the nodes under C to a different cluster, and nodes under A but not B or C would not be assigned to any cluster. This function returns a dendrogram of the middle stage, the hierarchy of consolidated nodes. Whether a node was selected as as cluster is an attribute of each node.

This function remains experimental in terms of finding the best way to represent an hdbscan object in a dendrogram.

Examples

1
2
3
4
data(iris)
vis <- largeVis(t(iris[,1:4]), K = 20, sgd_batches = 1, threads = 1)
hdbscanobj <- hdbscan(vis, minPts = 10, K = 5)
plot(as.dendrogram(hdbscanobj))

largeVis documentation built on Feb. 17, 2018, 1:01 a.m.