Tutorials › Multi-Omics Data Integration › Joint NMF With Shared Sample Scores

Non-Negative Matrix Factorization · Tutorial 201 of 597

Joint NMF With Shared Sample Scores

Learn how modality-specific feature profiles and shared sample scores form a joint NMF model, and how to fit and interpret its common sample representation.

Advanced 11 min read

What You'll Learn

  • Define the joint NMF model for multiple feature-by-sample matrices.
  • Distinguish modality-specific basis matrices from the shared sample-score matrix.
  • Derive the joint Frobenius objective and the conditional least-squares problem for shared scores.
  • Check the assumptions required for a shared sample representation to be useful.
  • Recognize scale, rank, and block-scale issues that affect interpretation.
  • Compare joint shared-score NMF with separate NMF fits and inspect basic fit diagnostics.

Why Share Sample Scores Across Omics Blocks?

Suppose the same \(n\) samples have been measured for several omics modalities, such as gene expression and metabolite abundance. Each modality has its own features, so the data naturally form several feature-by-sample matrices. A joint NMF model represents each matrix using its own feature profiles while requiring the samples to share the same low-dimensional score matrix. This creates a common coordinate system for the samples without requiring the feature sets to match.

The modeling choice is substantive: a shared score row says that a latent component has the same sample-level pattern across modalities. Its feature profile may differ by modality, but its relative activity across the aligned samples is represented jointly. Thus, shared scores can reveal coordinated sample structure, but they can also impose a poor approximation if the modalities have incompatible sample patterns.

Model and Objective

Definition: For \(M\) modalities measured on the same \(n\) samples, let \(X^{(m)}\in\mathbb{R}_{\ge 0}^{p_m\times n}\) be the feature-by-sample matrix for modality \(m\). A rank-\(r\) joint NMF with shared sample scores represents each block as \(X^{(m)}\approx W^{(m)}H\), where \(W^{(m)}\in\mathbb{R}_{\ge 0}^{p_m\times r}\) is the modality-specific basis matrix and \(H\in\mathbb{R}_{\ge 0}^{r\times n}\) is shared across all modalities. The basic joint Frobenius objective is $$ \min_{\substack{W^{(m)}\ge 0,\ m=1,\ldots,M\\ H\ge 0}} \ \frac{1}{2}\sum_{m=1}^{M}\left\|X^{(m)}-W^{(m)}H\right\|_F^2. $$

The \(k\)th column of \(W^{(m)}\) gives the feature profile of component \(k\) in modality \(m\); the \(k\)th row of \(H\) gives that component's scores across the \(n\) samples. In particular, \(H_{kj}\) is the shared score for component \(k\) in sample \(j\), while \(W^{(m)}_{ik}\) describes how strongly feature \(i\) in modality \(m\) contributes to that component. Rows of \(H\) must refer to the same component ordering in every block.

This formulation assumes the sample columns have been aligned correctly across blocks. The same column index \(j\) must refer to the same biological sample in every \(X^{(m)}\). The entries must also be nonnegative, and the approximation should be reasonably described by additive nonnegative components under squared-error loss. Finally, the shared-score assumption must be scientifically plausible: after allowing for different feature profiles, the modalities should contain some common sample-level structure.

Before fitting, preprocessing should address modality-specific measurement scales and technical effects sufficiently for a sum of squared residuals to be meaningful. The objective as written gives each block its raw contribution to the total loss. If one block has far more features or larger numerical values, it may dominate the fit. The choice of block scaling or weighting is consequential; it is not automatically solved by sharing \(H\).

Why the Score Update Uses Every Modality

For fixed basis matrices, estimating \(H\) means solving one nonnegative least-squares problem that combines the information from all modalities. The equivalent stacked-matrix view makes this structure explicit. Vertically concatenate the data blocks and their bases:

$$ X_{\mathrm{stack}}= \begin{bmatrix} X^{(1)}\\ \vdots\\ X^{(M)} \end{bmatrix}, \qquad W_{\mathrm{stack}}= \begin{bmatrix} W^{(1)}\\ \vdots\\ W^{(M)} \end{bmatrix}. $$

Then \(X_{\mathrm{stack}}\approx W_{\mathrm{stack}}H\), and the stacked residual norm is exactly the sum of the block residual norms. For fixed \(W^{(m)}\), the gradient of the half-scaled objective with respect to \(H\) is \(\sum_m W^{(m)\mathsf T}(W^{(m)}H-X^{(m)})\). Consequently, the shared score estimate balances residual information from every modality, subject to \(H\ge0\). For fixed \(H\), each \(W^{(m)}\) can instead be estimated from its own block by nonnegative least squares.

Justification: The Frobenius norm squared is the sum of the squared entries. The stacked residual contains each block residual once, so $$ \left\|X_{\mathrm{stack}}-W_{\mathrm{stack}}H\right\|_F^2 =\sum_{m=1}^{M}\left\|X^{(m)}-W^{(m)}H\right\|_F^2. $$ Differentiating \(\frac12\sum_m\|X^{(m)}-W^{(m)}H\|_F^2\) with respect to \(H\) gives \(\sum_m W^{(m)\mathsf T}(W^{(m)}H-X^{(m)})\). This establishes both the stacked interpretation and why the shared-score subproblem uses all blocks.

Alternating nonnegative least squares or other constrained optimization methods can be used to minimize the objective. As with ordinary NMF, the objective is not jointly convex in all factors, so an algorithm generally finds a stationary solution dependent on initialization rather than guaranteeing a global minimum. Nonnegative constraints must be respected throughout optimization.

Worked Example: Reconstructing Two Omics Blocks

Consider two hypothetical modalities, each with two features measured on two aligned samples. Let the rank be \(r=1\), with \(H=\begin{bmatrix}2&1\end{bmatrix}\), \(W^{(1)}=\begin{bmatrix}2\\1\end{bmatrix}\), and \(W^{(2)}=\begin{bmatrix}1\\3\end{bmatrix}\). The implied reconstructions are

$$ W^{(1)}H= \begin{bmatrix}2\\1\end{bmatrix} \begin{bmatrix}2&1\end{bmatrix} = \begin{bmatrix}4&2\\2&1\end{bmatrix}, \qquad W^{(2)}H= \begin{bmatrix}1\\3\end{bmatrix} \begin{bmatrix}2&1\end{bmatrix} = \begin{bmatrix}2&1\\6&3\end{bmatrix}. $$

If these are the observed matrices, both residuals are zero and the joint objective is \(0\). The shared score is \(2\) for sample 1 and \(1\) for sample 2 in both modalities. The feature profiles differ: modality 1 has loadings \(2\) and \(1\), while modality 2 has loadings \(1\) and \(3\). Thus sharing \(H\) does not mean that the modalities have identical feature contributions; it means the component's sample pattern is common.

Worked Example: Combining Modalities in a Shared-Score Estimate

For one hypothetical sample and one component, suppose the basis value in modality 1 is \(2\), the observed value is \(6\), and the basis value and observation in modality 2 are \(1\) and \(2\). With the basis values fixed, the shared score \(h\ge0\) minimizes \((6-2h)^2+(2-h)^2\). Differentiating the objective gives

$$ -4(6-2h)-2(2-h)=0 \quad\Longrightarrow\quad 10h=28 \quad\Longrightarrow\quad h=2.8. $$

This score is nonnegative, so it satisfies the constraint. The fitted values are \(2(2.8)=5.6\) and \(1(2.8)=2.8\). The residuals are \(0.4\) and \(-0.8\), giving total squared error \(0.4^2+(-0.8)^2=0.16+0.64=0.80\). The score is a compromise: both modalities inform the same \(h\), and neither block is fit independently in this conditional update.

Worked Example: When a Shared Rank-One Score Cannot Fit Exactly

Suppose two hypothetical one-feature blocks contain two aligned samples: \(X^{(1)}=\begin{bmatrix}1&2\end{bmatrix}\) and \(X^{(2)}=\begin{bmatrix}1&4\end{bmatrix}\). For an exact shared rank-one fit, the positive basis values \(w^{(1)}\) and \(w^{(2)}\) would require \(X^{(1)}=w^{(1)}H\) and \(X^{(2)}=w^{(2)}H\). The ratio of sample 2 to sample 1 must therefore be the same in both blocks, since each basis value cancels:

$$ \frac{H_{1,2}}{H_{1,1}} =\frac{2}{1}=2 \quad\text{and}\quad \frac{H_{1,2}}{H_{1,1}} =\frac{4}{1}=4. $$

These requirements contradict one another, so no exact shared rank-one representation exists. Separate rank-one fits can reconstruct the blocks exactly with scores \(\begin{bmatrix}1&2\end{bmatrix}\) and \(\begin{bmatrix}1&4\end{bmatrix}\), respectively, and basis value \(1\) for each. This example shows why a shared-score model is an assumption to assess, not a guarantee that all modalities have the same sample pattern.

Interpretation, Diagnostics, and Alternatives

A component with high scores in a subset of samples may summarize a sample pattern that is represented through different features in different modalities. It is reasonable to describe such a pattern as shared in this fitted representation. It is not, by itself, evidence that one modality causes a change in another, nor does it identify a biological mechanism.

The model has familiar NMF indeterminacies. Components can be permuted jointly across all basis matrices and \(H\) without changing the fit. Also, for any positive diagonal matrix \(D\), replacing \(H\) by \(DH\) and each \(W^{(m)}\) by \(W^{(m)}D^{-1}\) leaves every product unchanged. Therefore, individual basis and score magnitudes are not intrinsically identified without a normalization convention. A common rescaling across all modalities preserves shared scores; separately rescaling the scores for just one modality would break the shared model.

Useful diagnostics start with the block residuals \(X^{(m)}-W^{(m)}H\). Compare their magnitudes and patterns by modality, not just the total objective. A small total error can conceal poor fit in one block. Structured residual patterns, a component with negligible scores, or highly different sample patterns demanded by separate fits can indicate that the shared rank or shared-score assumption is inadequate. Check that the sample alignment and nonnegativity are valid, and verify that the algorithm has not stopped at a solution with appreciably worse objective than other initializations.

A common mistake is to interpret a shared score as proof that the corresponding signal is equally strong in every modality. The correction is that \(H\) describes common sample scores, whereas each \(W^{(m)}\) has its own feature profile and scale. Another pitfall is comparing raw score magnitudes without accounting for scale indeterminacy or block preprocessing.

ApproachWhat is sharedWhen it is usefulMain caution
Joint NMF with shared scoresSample-score matrix \(H\)Common sample patterns are scientifically plausibleA restrictive shared structure can leave systematic residuals
Separate NMF fitsNothing is constrained to be commonModalities may have distinct sample structureComponents and scores need not align across independently fitted blocks
Single concatenated NMF with unconstrained feature rowsOne score matrix for the concatenated dataEquivalent to the stacked form of this shared-score objectiveRaw block scale and feature count can influence the fit

The stacked formulation is not a different model from shared-score joint NMF: it is the same factorization written as one larger matrix. Separate NMF is less restrictive but does not directly impose a common sample representation. A joint fit can therefore be valuable when cross-modal sample patterns are the target, provided the assumptions and residuals are examined rather than inferred from the model definition alone.

Key takeaway: Joint NMF with shared sample scores uses one nonnegative \(H\) across all blocks and a distinct nonnegative \(W^{(m)}\) for each modality. Its value is a common sample representation; its central risk is forcing that representation when the blocks do not support it.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. For two modalities with \(p_1=100\), \(p_2=50\), \(n=30\), and rank \(r=4\), what are the dimensions of \(W^{(1)}\), \(W^{(2)}\), and \(H\)?
  2. Why must sample columns be aligned before fitting a shared-score model?
  3. For fixed bases, explain why estimating \(H\) uses information from every modality.
  4. If a fitted component has a large score in sample \(j\), what can and cannot be concluded about the component across modalities?

Solutions. (1) \(W^{(1)}\) is \(100\times4\), \(W^{(2)}\) is \(50\times4\), and \(H\) is \(4\times30\). (2) Column \(j\) of every block must refer to the same sample; otherwise one shared score would combine different individuals. (3) The conditional objective is the sum of squared residuals over all blocks, and its gradient is \(\sum_m W^{(m)\mathsf T}(W^{(m)}H-X^{(m)})\), so every block contributes. (4) The score indicates a high fitted shared sample score for that component. The modality-specific feature profiles can differ, and the score alone does not establish equal feature effects, causation, or a biological mechanism.

Clinical Biostats