Skip to contents

Performs EVoC (Embedding Vector Oriented Clustering) on the input data. Combines a UMAP-like node embedding with HDBSCAN-style density-based clustering and multi-layer persistence analysis.

Usage

evoc(
  data,
  knn = NULL,
  n_neighbours = 15L,
  knn_method = c("nndescent", "kmknn", "hnsw", "annoy", "balltree", "ivf", "exhaustive"),
  nn_params = params_nn(),
  evoc_params = params_evoc(),
  return_knn = FALSE,
  seed = 42L,
  .verbose = TRUE
)

Arguments

data

Numerical matrix or data frame. The data to cluster, of shape samples x features. Will be coerced to a matrix.

knn

Optional NearestNeighbours class. If provided, EVoC will skip the kNN graph generation and use this one. Defaults to NULL.

n_neighbours

Integer. Number of nearest neighbours for graph construction. Defaults to 15L.

knn_method

Character. (Approximate) Nearest neighbour method to use. One of "kmknn", "hnsw", "annoy", "nndescent", "balltree", "ivf" or "exhaustive". Defaults to "nndescent".

nn_params

Named list. Nearest neighbour search parameters, see params_nn().

evoc_params

Named list. EVoC algorithm parameters, see params_evoc().

return_knn

Logical. Whether to return the kNN graph. If knn is provided, it is returned as-is. Defaults to FALSE.

seed

Integer. Random seed for reproducibility. Defaults to 42L.

.verbose

Logical or integer 0L to 2L. Controls verbosity. Defaults to TRUE.

Value

An Evoc S3 object (see print.Evoc, best_membership, get_layer).

Examples

d <- manifold_synthetic_data(type = "clusters", n_samples = 500L)
res <- evoc(d$data, .verbose = FALSE)
res
#> Evoc
#>   layers:               2 
#>   best layer:           2 
#>   best persistence:     76.7277 
#>   knn:                  not stored