embedding<-function(fit,r){
embed <- fit$u[,1:r]%*%diag(sqrt(fit$d[1:r]))
embed
}Embedding
Description
The embedding function extracts a low-dimensional representation from the results of a singular value decomposition (SVD). This function is useful for dimensionality reduction, creating a compact embedding that preserves significant data characteristics.
Arguments
fit: An object containing the SVD results, with componentsu(left singular vectors) andd(singular values).r: The target dimensionality for the embedding (number of components to retain).
Output
- Returns a matrix representing the embedding of the data, obtained by multiplying the first
rcolumns ofuwith the diagonal matrix of the square root of the firstrsingular values.
See also
See BONMI_package for code example.