Projects/STL NMF
FEATURED RESEARCH · AI & MATHEMATICS

Spatial Transcriptomics Learned Non-negative Matrix Factorization

STL NMF is the culmination of my research in Non-negative Matrix Factorization (NMF) and its application to Spatial Transcriptomics data. This work took place at Case Western Reserve University under the guidance of Dr. Weihong Guo, with the endless support of fellow researcher Jiasen Zhang. Read more about the method and resulting paper below.

Background

Spatial transcriptomics is the study of spatial transcriptomics data (X) — a count matrix of m genes across n spatial locations. This ST data is often aided by an RNA-seq reference dataset (B) — an expression matrix of the same m genes across p single cells.

X=[x1,1x1,2x1,mx2,1x2,2x2,mxn,1xn,2xn,m]X = \left[ \begin{matrix} x_{1,1} & x_{1,2} & \ldots & x_{1,m} \\ x_{2,1} & x_{2,2} & \ldots & x_{2,m} \\ \vdots & \vdots & \ddots & \vdots \\ x_{n,1} & x_{n,2} & \ldots & x_{n,m} \end{matrix}\right]
B=[b1,1b1,2b1,pb2,1b2,2b2,pbn,1bn,2bn,p]B = \left[ \begin{matrix} b_{1,1} & b_{1,2} & \ldots & b_{1,p} \\ b_{2,1} & b_{2,2} & \ldots & b_{2,p} \\ \vdots & \vdots & \ddots & \vdots \\ b_{n,1} & b_{n,2} & \ldots & b_{n,p} \end{matrix}\right]

Biologically, genes and cells are linked through both position and function. Using this, Patrik Ståhl et al. first proposed using Spatial Transcriptomics data to deconvolve a spatial mapping of genes into a spatial mapping of cell types (V).

There are many strategies to do this, each with strengths and weaknesses — the most popular being deep-learning, probabilistic, optimal-transport, and NMF-based methods. My research focuses on NMF.

V=[v1,1v1,2v1,mv2,1v2,2v2,mvp,1vp,2vp,m]V = \left[ \begin{matrix} v_{1,1} & v_{1,2} & \ldots & v_{1,m} \\ v_{2,1} & v_{2,2} & \ldots & v_{2,m} \\ \vdots & \vdots & \ddots & \vdots \\ v_{p,1} & v_{p,2} & \ldots & v_{p,m} \end{matrix}\right]

Deconvolution

To set up a matrix-factorization solution, we start from the equation X = BV + ε. From here we aim to find the "true" V, given both X and B. We then use the fact that all three matrices are non-negative (every entry is zero or a positive real), which gives us a way to solve for V (eq. 2).

X=BV+ε(eq. 1)X = BV + \varepsilon \quad (eq.\ 1)
minVT,B0XBVF2(eq. 2)\min_{V^T, B \geq 0} ||X - BV||_F^2 \quad (eq.\ 2)

However, this leaves an ill-posed optimization problem that struggles to find unique solutions. Luckily, we can apply biological priors as regularization terms to guide it toward an optimal solution.

Locations that are close together and within the same biological region should have far more similar genetic makeups than distant spots. We encode this with an adjacency term in the objective that limits NMF's freedom, enforcing similarity across nearby locations and disparity across distant ones. We also know the total proportion of all cell types in one location should sum to one — a sum-to-one constraint on the columns of V.

After adding these terms (plus one more, mostly inconsequential), we arrive at the objective (eq. 3) and its multiplicative update rule (eq. 4).

minVT0XBVF2+λ1Tr(VLVT)+λ2VTJJmF2+λ3WVF2(eq. 3)\min_{V^T \geq 0} ||X - BV||_F^2 + \lambda_1 \textrm{Tr}\left(VLV^T\right) + \lambda_2 ||V^TJ-J_m||^2_F + \lambda_3 ||WV||^2_F \quad (eq.\ 3)
VT=VjkT(XTB+λ1AVT+λ2JmJmT)jk(VTBTB+λ1DVT+λ2VTJJT+λ3VTWTW)jk(eq. 4)V^T = \frac{V^T_{jk}\left(X^TB+\lambda_1AV^T+\lambda_2J_mJ_m^T\right)_{jk}}{\left(V^TB^TB+\lambda_1DV^T+\lambda_2V^TJJ^T+\lambda_3V^TW^TW\right)_{jk}} \quad (eq.\ 4)

With the problem defined, we can solve it: start from an initialized (random) matrix V and iteratively apply the update rule (eq. 4). Over time V converges to a stable solution that best approximates the "true" V. Even so, this solution is imperfect — it relies heavily on good choices of hyperparameters (λ₁, λ₂, λ₃, W).

Algorithm Unrolling

To address that reliance, we use a strategy called algorithm unrolling, first proposed by Gregor and LeCun in 2010. It transforms our iterative optimization into a (repetitive) single-layer neural network that trains on the problem's hyperparameters. Doing so, we learn the optimal hyperparameters (λ₁, λ₂, λ₃, W) and push our solution past many state-of-the-art methods.

Read the full technical write-up
Unrolling Regularized Non-negative Matrix Factorization for Spatial Transcriptomics Deconvolution
Read the paper ↗
© 2026 Grant Konkel · Cleveland, OH← Back home