R/dimred_lle.R

Defines functions dimred_lle

Documented in dimred_lle

#' @rdname dimred
#' @export
dimred_lle <- function(x, ndim = 3) {
  if (is_sparse(x)) {
    x <- as.matrix(x)
  }

  requireNamespace("lle")

  x_sc <- t(scale(t(x)))

  k <- lle::calc_k(x_sc, m = ndim)

  k <- k$k[which.min(k$rho)]

  space <- lle::lle(x_sc, m = ndim, k = k)$Y

  .process_dimred(space, rownames(x))
}

Try the dyndimred package in your browser

Any scripts or data that you put into this service are public.

dyndimred documentation built on March 23, 2021, 9:06 a.m.