PNMFfun: Fitting PNMF Models

View source: R/pNMF_func.R

PNMFfunR Documentation

Fitting PNMF Models

Description

Fast Projective Nonnegative Matrix Factorization Realizatiton based on Euclidean Distance / KL Divergence / Discriminant pNMF.

Usage

PNMFfun(
  X,
  K = 10,
  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).

K

Specification of the factorization rank (number of low dimension).

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.

Details

Given a data matrix (rows as features and columns as samples), this function computes the Projective Nonnegative Matrix Factorization (PNMF). Based on different objective functions, the choices are Euclidean distance ("EucDist"), KL divergence ("KL") (Yang, Zhirong, and Erkki Oja. 2010), or Discriminant PNMF ("DPNMF") (Guan, Naiyang, et al. 2013). "EucDist" is supposed to be the most common one; "KL" is similar to KL-NMF (Poisson-NMF), and may work better for count data; "DPNMF" requires the predefined labels.

The fitting result of PNMF shares characteristics of both PCA and NMF. The model returns a basis matrix, which is similar to the loading matrix in PCA. However, notice that unlike in PCA the first PC always represents the largest variation, each basis vectors are equal in PNMF.

Value

A list with components:

Weight

The basis of model fit (W).

Score

The mapped scores (W^TX), which is the dimension reduced result.

Author(s)

Kexin Li, aileenlikexin@outlook.com

Dongyuan Song, dongyuansong@g.ucla.edu

References

  • Yang, Z., & Oja, E. (2010). Linear and nonlinear projective nonnegative matrix factorization. IEEE Transactions on Neural Networks, 21(5), 734-749.

  • Guan, N., Zhang, X., Luo, Z., Tao, D., & Yang, X. (2013). Discriminant projective non-negative matrix factorization. PloS one, 8(12), e83291.

  • https://github.com/richardbeare/pNMF

Examples

data(zheng4)
X <- SummarizedExperiment::assay(zheng4, "logcounts")
res_pnmf <- scPNMF::PNMFfun(X = X,
                           K = 3,
                           method="EucDist", 
                           tol=1e-4, 
                           maxIter=100,
                           verboseN = FALSE)

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