p_noise: Noise-point scores

View source: R/disco.R

p_noiseR Documentation

Noise-point scores

Description

Assigns a quality score to each point labelled as noise (-1). Two complementary sub-scores are computed and the element-wise minimum is taken as the final score:

p_{\text{sparse}}

Measures whether the noise point is sparser (more peripheral in density) than the densest part of every real cluster. For cluster c, let M_c be the maximum core distance over all points in c. Then

p_{\text{sparse}}(i) = \min_c \frac{\text{core}_k(i) - M_c}{\max(\text{core}_k(i),\, M_c)}.

p_{\text{far}}

Measures whether the noise point is far from every cluster in DC-distance space. For cluster c, let d_{\min,c}(i) be the minimum DC distance from i to any point in c. Then

p_{\text{far}}(i) = \min_c \frac{d_{\min,c}(i) - M_c}{\max(d_{\min,c}(i),\, M_c)}.

Both sub-scores lie in [-1, 1]: positive means the noise point is legitimately sparse/far; negative means it is denser/closer than the cluster boundary and might be a misclassified inlier.

Usage

p_noise(X, labels, min_points = 5, dc_dists = NULL)

Arguments

X

A numeric matrix (n \times p) or data.frame of all points (including non-noise).

labels

An integer vector of length n; -1 denotes noise.

min_points

Positive integer \geq 2; core-distance neighbourhood size. Default is 5.

dc_dists

Optional precomputed n \times n DC-distance matrix. If NULL (default), it is computed internally.

Value

A named list with two numeric vectors, each of length equal to the number of noise points:

p_sparse

Sparsity-based noise scores.

p_far

DC-distance-based noise scores.

See Also

disco_samples

Examples

set.seed(3)
X      <- matrix(rnorm(60), ncol = 2)   # 30 rows x 2 cols
labels <- c(rep(0L, 10), rep(1L, 10), rep(-1L, 10))  # 30 labels
nr     <- p_noise(X, labels, min_points = 3)
str(nr)

discoCVI documentation built on Oct. 28, 2026, 1:07 a.m.