Learn R Programming

RcppPlanc (version 2.0.13)

inmf: Perform Integrative Non-negative Matrix Factorization

Description

Performs integrative non-negative matrix factorization (iNMF) (J.D. Welch, 2019) to return factorized \(H\), \(W\), and \(V\) matrices. The objective function is stated as

$$\arg\min_{H\ge0,W\ge0,V\ge0}\sum_{i}^{d}||E_i-(W+V_i)Hi||^2_F+ \lambda\sum_{i}^{d}||V_iH_i||_F^2$$

where \(E_i\) is the input non-negative matrix of the \(i\)'th dataset, \(d\) is the total number of datasets. \(E_i\) is of size \(m \times n_i\) for \(m\) features and \(n_i\) sample points, \(H_i\) is of size \(k \times n_i\), \(V_i\) is of size \(m \times k\), and \(W\) is of size \(m \times k\).

inmf optimizes the objective with ANLS strategy, while onlineINMF optimizes the same objective with an online learning strategy.

Usage

inmf(
  objectList,
  k = 20,
  lambda = 5,
  niter = 30,
  nCores = 2,
  Hinit = NULL,
  Vinit = NULL,
  Winit = NULL,
  verbose = FALSE
)

Value

A list of the following elements:

  • H - a list of result \(H_i\) matrices of size \(n_i \times k\)

  • V - a list of result \(V_i\) matrices

  • W - the result \(W\) matrix

  • objErr - the final objective error value.

Arguments

objectList

list of input datasets. List elements should all be of the same class. Viable classes include: matrix, dgCMatrix, H5Mat, H5SpMat.

k

Integer. Inner dimensionality to factorize the datasets into. Default 20.

lambda

Regularization parameter. Larger values penalize dataset-specific effects more strongly (i.e. alignment should increase as lambda increases). Default 5.

niter

Integer. Total number of block coordinate descent iterations to perform. Default 30.

nCores

The number of parallel tasks that will be spawned. Default 2

Hinit

Initial values to use for \(H\) matrices. A list object where each element is the initial \(H\) matrix of each dataset. Each should be dense matrix of size \(n_i \times k\). Default NULL.

Vinit

Similar to Hinit, but each should be of size \(m \times k\).

Winit

Initial values to use for \(W\) matrix. A matrix object of size \(m \times k\). Default NULL.

verbose

Logical scalar. Whether to show information and progress. Default FALSE.

Author

Yichen Wang

References

Joshua D. Welch and et al., Single-Cell Multi-omic Integration Compares and Contrasts Features of Brain Cell Identity, Cell, 2019

Examples

Run this code
library(Matrix)
set.seed(1)
result <- inmf(list(ctrl.sparse, stim.sparse), k = 10, niter = 10, verbose = FALSE)

Run the code above in your browser using DataLab