Function er_project projects the embedding into a two or more dimensional space using the non-linear dimensionality reduction techniques MDS, UMAP, and PaCMAP.

er_project(embedding, method = "mds", k = 2, ..., verbose = FALSE)

Arguments

embedding

a numeric matrix containing a text embedding.

method

a character string specifying the type of projection. One of c("mds","umap","pacmap"). Default is "mds". Projection method "PaCMAP" is based on the Python library pacmap (see pypi.org/project/pacmap/) and requires access to a python environment

k

an integer determining the number of dimensions. Default is 2.

...

additional parameters handed to the projection method.

verbose

a logical indicating whether to show messages.

Value

The function returns a matrix containing an embedding with columns representing the projected coordinates. The matrix has nrow(embedding) rows and k columns.

References

Wulff, D. U., Aeschbach, S., Hussain, Z., & Mata, R. (2024). embeddeR. In preparation.

Examples

if (FALSE) {
# project embedding
embedding <- embedding %>%
  er_project()
}