Skip to contents

Run a Non-negative Matrix Factorization dimensionality reduction with rank determination by cross-validation.

Usage

# S3 method for Seurat
RunNMF(
  object,
  k = NULL,
  assay = NULL,
  reduction.name = "nmf",
  reduction.key = "NMF_",
  verbose = 2,
  reps = 3,
  test.set.density = 0.05,
  tol = 1e-05,
  maxit = 100,
  L1 = 0.01,
  L2 = 0,
  threads = 0,
  split.by = NULL,
  ...
)

RunNMF(object, ...)

Arguments

object

A Seurat object

k

vector of ranks at which to fit, witholding a test set. Leave NULL for entirely automatic rank determination.

assay

Assay to use, defaults to the default assay of the first object

reduction.name

Name to store resulting DimReduc object as

reduction.key

Key for resulting DimReduc

verbose

Level of console output (0/FALSE, 1/TRUE, 2)

reps

number of replicates for cross-validation

test.set.density

approximate density of the test set (default 0.05)

tol

tolerance of the fit (correlation distance of the model across consecutive iterations). Cross-validation fits are 10x coarser than this tolerance.

maxit

maximum number of fitting iterations

L1

L1/LASSO penalty to increase sparsity of the model

L2

L2/Ridge-like penalty to increase angles between factors

threads

number of threads to use (0 = let OpenMP use all available threads)

split.by

column name in @meta.data giving a Factor with multiple levels for splitting. Data will be weighted such that each group contributes equally to the LNMF model.

...

not implemented

Value

Returns a Seurat object with the NMF model stored in the reductions slot

Details

Use set.seed() to guarantee reproducibility!