R/decomp_tSNE.R

# decomp_tSNE.R
# ::rtemis::
# 2025- EDG rtemis.org

# %% decomp_.tSNEConfig ----
#' tSNE Decomposition
#'
#' @keywords internal
#' @noRd
method(decomp_, tSNEConfig) <- function(
  config,
  x,
  execution_config = NULL,
  verbosity = 1L
) {
  # Checks ----
  check_is_S7(config, tSNEConfig)
  check_dependencies("Rtsne")
  check_unsupervised_data(x = x, allow_missing = FALSE, verbosity = verbosity)

  # Decompose ----
  msg("Decomposing with", config@algorithm, "...", verbosity = verbosity)
  args <- c(
    list(
      X = x,
      dims = config[["k"]],
      num_threads = algorithm_threads(execution_config)
    ),
    config@config
  )
  args[["k"]] <- NULL
  decom <- do_call(
    Rtsne::Rtsne,
    args,
    error_pattern_suggestion = list(
      "Remove duplicates" = "Remove duplicates using `preprocess()"
    ),
    verbosity = verbosity
  )
  check_inherits(decom, "Rtsne")
  list(decom = decom, transformed = decom[["Y"]])
} # /rtemis::decomp_.tSNEConfig

Try the rtemis package in your browser

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

rtemis documentation built on Oct. 20, 2026, 1:06 a.m.