| disco_samples | R Documentation |
Computes a pointwise DISCO score for every observation in X. The
score lies in [-1, 1]:
Values close to 1 indicate a well-placed point (either
tightly within its cluster or a noise point far from all clusters).
Values close to 0 indicate borderline placement.
Values close to -1 indicate a misplaced point (or a noise
point that should belong to a cluster).
Four cases are handled:
All noise — every point labelled -1: all scores
are -1.
Single cluster with no noise — all scores are 0.
One real cluster + noise — cluster points are scored via
p_cluster; noise points are scored via
p_noise.
Two or more clusters (optional noise) — non-noise points
use p_cluster on the non-noise sub-matrix; noise points
use p_noise.
Since version 0.2.0 these quantities are computed from the merge tree of
the mutual-reachability minimum spanning tree, without storing any
n \times n matrix: memory grows linearly with n (times the
number of clusters), and the scores are identical to the previous
matrix-based implementation up to floating-point rounding.
disco_samples(X, labels, min_points = 5)
X |
A numeric matrix ( |
labels |
An integer vector of length |
min_points |
A positive integer for the core-distance neighbourhood
size. Default is |
A numeric vector of length n with per-point DISCO scores.
disco_score, p_cluster,
p_noise
set.seed(42)
X <- matrix(rnorm(100), ncol = 2)
labels <- rep(c(0L, 1L), each = 25)
s <- disco_samples(X, labels)
hist(s, main = "Per-sample DISCO scores")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.