Skip to contents

Performs PaCMAP dimensionality reduction on the input data. This function provides a user-friendly interface with input validation before calling the Rust implementation.

Usage

pacmap(
  data,
  knn = NULL,
  n_dim = 2L,
  k = 10L,
  knn_method = c("kmknn", "balltree", "hnsw", "annoy", "nndescent", "exhaustive"),
  nn_params = params_nn(),
  pacmap_params = params_pacmap(),
  seed = 42L,
  .verbose = TRUE
)

Arguments

data

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

knn

Optional NearestNeighbours class. If provided, PaCMAP will skip the k-nearest neighbour graph generation and use this one. Defaults to NULL.

n_dim

Integer. Number of dimensions in the embedding space. Defaults to 2L.

k

Integer. Number of nearest neighbours to consider. Defaults to 10L. Note that the kNN search will use mn_candidate_end neighbours internally; k only controls the near pairs used in optimisation.

knn_method

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

nn_params

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

pacmap_params

Named list. PaCMAP algorithm parameters, see params_pacmap().

seed

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

.verbose

Logical. Controls verbosity. Defaults to TRUE.

Value

A numerical matrix with dimensions samples x n_dim containing the PaCMAP embedding.