K_selection: Title K selection based on *dev.ortho*

View source: R/K_selection.R

K_selectionR Documentation

Title K selection based on *dev.ortho*

Description

A low rank K selection method based on *dev.ortho*, the normalized difference between \mathbf{W}^T\mathbf{W} and \mathbf{I}. It runs the PNMF algorithm on every candidate K provided by the user, and find the elbow point K as the suggested one.

However, this process can be time-consuming as it needs to run the PNMF algorithm on every candidate K. Empirically we recommend the users to skip this section, and directly use K=20 in function [PNMFfun()], as we found it reaches stability for most scRNA-seq data.

Usage

K_selection(
  X,
  K.seq = 10L:30L,
  ncores = 1,
  tol = 0.001,
  maxIter = 500,
  verboseN = FALSE,
  zerotol = 1e-10,
  method = "EucDist",
  label = NULL,
  mu = 1,
  lambda = 0.01,
  seed = 123
)

Arguments

X

Input data matrix, where rows represent features (genes), columns represent samples (cells). Rownames (gene names) and colnames (cell names) are required.

K.seq

An integer vector of candidate K's. All elements need to be distinct integers, and the total number needs to be no fewer than 5.

ncores

The number of cores to use.

tol

A threshold below which would be considered converged. Default is 1e-3.

maxIter

Number of max iteration times. Default is 500.

verboseN

A boolean value indicating whether to print number of iterations.

zerotol

A threshold on basis loadings below which would be considered zero. Default is 1e-10.

method

A character string indicating which method to be used. One of "EucDist", "KL", or "DPNMF".

label

A character vector indicating the cluster type for each cell. Required only when method = "DPNMF".

mu

A numerical value which controls the penalty term. Larger mu represents haivier penalization of class distances in DPNMF. Default is 1.

lambda

A numerical value which controls the magnituide of within class distances. Larger lambda represents larger proportion of within class distances in the total penalty term. Default is 0.01.

seed

Random seed of the initialization.

Value

A list with components:

BestK

The selected elbow point K.

BestRes

The list containing the Weight and Score returned by the PNMF algorithm corresponding to BestK.

plot.dev.ortho

dev.ortho plot.

AllRes

A list containing all PNMF outputs for all candidate K's in K.seq.

Author(s)

Kexin Li, aileenlikexin@outlook.com


JSB-UCLA/scPNMF documentation built on July 19, 2023, 10:28 p.m.