Skip to content

This function takes a three-dimensional array of embeddings and converts them to a two-dimensional matrix based on the specified strategy.

Usage

embeddings_to_matrix(embeddings, strategy = "average")

Arguments

embeddings

A three-dimensional array of shape (number_of_texts, number_of_words, embedding_dimension).

strategy

A character string specifying the strategy to use. Options are "average", "concatenate", "max_pooling", and "min_pooling".

Value

A two-dimensional matrix with the transformed embeddings.

Examples

if (FALSE) { # \dontrun{
embeddings <- array(runif(10 * 5 * 3), c(10, 5, 3))
result <- embeddings_to_matrix(embeddings, strategy = "average")
} # }