Computes a UMAP (Uniform Manifold Approximation and Projection) embedding
of the spectral data. Requires the uwot package.
Usage
hs_umap(
cube,
n_components = 2L,
n_neighbors = 15L,
min_dist = 0.1,
pca_pre = 20L,
seed = 1L
)Arguments
- cube
An hsi_cube object.
- n_components
Integer. UMAP dimensions. Default
2.- n_neighbors
Integer. Default
15.- min_dist
Numeric. Default
0.1.- pca_pre
Integer or NULL. PCA pre-reduction dimensionality. Default
20.- seed
Integer random seed. Default 1; the caller's random state is restored.
Details
If the PCA dependency raises its known NULL-input error on older R,
UMAP retries with base SVD for PCA when supported by uwot and reports a
message of class hyperspectR_umap_pca_fallback. Other errors, including
failures in older uwot versions without this option, propagate unchanged.
Examples
# \donttest{
# Requires uwot package
cube <- hs_example_cube()
if (requireNamespace("uwot", quietly = TRUE)) {
umap_result <- hs_umap(cube, n_components = 2)
}
# }