Function er_cluster
generates clusters of embedding vectors using standard clustering algorithms.
er_cluster(
embedding,
method = "hclust",
k = NULL,
eps = NULL,
metric = "arccos",
...,
verbose = FALSE
)
a numeric
matrix containing a text embedding.
a character
string specifying the clustering method One of c("hclust","dbscan","louvain")
. Default is "hclust"
.
an integer
specifying the number of clusters for method = "hclust"
.
a numeric
specifying the within-cluster point distance for method = "dbscan"
.
a character
string specifying the similarity function used for methods c("hclust","louvain")
.
further arguments passed on to the clustering methods. Can be used, e.g., to specify the linkage criterion in hierarchical clustering (see hclust), the minimum number of points in DBSCAN clustering (see dbscan), or the resolution in Louvain clustering (see cluster_louvain).
a logical
specifying whether to show messages.'
The function returns a matrix
containing the input embedding, which has gained a new attribute "cluster"
.
Wulff, D. U., Aeschbach, S., Hussain, Z., & Mata, R. (2024). embeddeR. In preparation.
if (FALSE) {
# add clustering to embedding
embedding <- er_cluster(embedding)
}