Skip to contents

Computes the UMAP projection for the model's training features and stores it inside the model object as projection_train. If already present and force = FALSE, returns the model unchanged.

Usage

DLBCLone_activate(
  optimized_model,
  seed = 12345,
  force = FALSE,
  store_labeled = TRUE
)

Arguments

optimized_model

A DLBCLone optimized model (list) that contains at least $model (frozen uwot model), $features (training feature matrix with rownames), $df (training metadata incl. sample_id and labels), $best_params$na_option, and $truth_column.

seed

Integer seed for reproducibility (passed to make_and_annotate_umap).

force

Logical; if TRUE, recompute even if projection is already present.

store_labeled

Logical; if TRUE, also store a pre-joined projection_train_labeled with coordinates + truth labels.

Value

The same optimized_model list with $projection_train added (and optionally $projection_train_labeled). Each are data frames containing the UMAP coordinates for the training samples, joined to sample_id and (if requested) the truth labels, in the latter.

Examples

if (FALSE) { # \dontrun{

# activating a model after optimization
optimized_model <- DLBCLone_optimize(
 df = df_LySeqST,
 features = feat_status_LySeqST
)
activated_model <- DLBCLone_activate(optimized_model)
# projection_train is now present and will be used by DLBCLone_predict()

# activating a model after loading from disk
 loaded_model <- DLBCLone_load_optimized(
 path = "models",
 name_prefix = "DLBCLone_LySeqST")
loaded_model <- DLBCLone_activate(loaded_model, force = TRUE)
} # }