uinmf: Perform Mosaic Integrative Non-negative Matrix Factorization...

View source: R/INMF.R

uinmfR Documentation

Perform Mosaic Integrative Non-negative Matrix Factorization with Unshared Features

Description

Performs mosaic integrative non-negative matrix factorization (UINMF) (A.R. Kriebel, 2022) to return factorized H, W, V and U matrices. The objective function is stated as

\arg\min_{H\ge0,W\ge0,V\ge0,U\ge0}\sum_{i}^{d} ||\begin{bmatrix}E_i \\ P_i \end{bmatrix} - (\begin{bmatrix}W \\ 0 \end{bmatrix}+ \begin{bmatrix}V_i \\ U_i \end{bmatrix})Hi||^2_F+ \lambda_i\sum_{i}^{d}||\begin{bmatrix}V_i \\ U_i \end{bmatrix}H_i||_F^2

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

Similar to inmf, uinmf also optimizes the objective with ANLS algorithm.

Usage

uinmf(
  objectList,
  unsharedList,
  k = 20,
  lambda = 5,
  niter = 30,
  nCores = 2,
  verbose = FALSE
)

Arguments

objectList

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

unsharedList

List of input unshared feature matrices, with the same requirement as objectList.

k

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

lambda

Regularization parameter. Use one number for all datasets or a vector to specify for each dataset. 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.

verbose

Logical scalar. Whether to show information and progress. Default 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

  • U - a list of result A_i matrices

  • objErr - the final objective error value.

Author(s)

Yichen Wang

References

April R. Kriebel and Joshua D. Welch, UINMF performs mosaic integration of single-cell multi-omic datasets using nonnegative matrix factorization, Nat. Comm., 2022

Examples

# Fake matrices representing unshared features of the given datasets
# Real-life use should have features that are not presented in the
# intersection of features of all datasets involved.
ctrl.unshared <- ctrl.sparse[1:10,]
stim.unshared <- stim.sparse[11:30,]
set.seed(1)
result <- uinmf(list(ctrl.sparse, stim.sparse),
                list(ctrl.unshared, stim.unshared), verbose = FALSE)

RcppPlanc documentation built on April 15, 2025, 1:11 a.m.