Skip to contents

Groups a signature set into cosine-threshold connected components: signatures with pairwise cosine >= `threshold` share a cluster. Each cluster reports its size and its medoid (the member with the highest mean within-cluster cosine). Deterministic.

Usage

ms_cluster_signatures(signatures, threshold = 0.9)

Arguments

signatures

An m x k numeric matrix (columns sum to 1 after normalization; canonical rownames enforced as everywhere), or an [MsSignature].

threshold

Single number in (0, 1]: the cosine join threshold (default 0.90, the Islam TP line).

Value

A data.frame with one row per signature: `signature`, `cluster` (label `C1`, `C2`, ... by descending size), `is_medoid`, `cluster_size`; the pairwise cosine matrix rides as attribute `cosines`.