Tutorials › Multi-Omics Data Integration › Shared and Modality-Specific Components

Non-Negative Matrix Factorization · Tutorial 203 of 597

Shared and Modality-Specific Components

Learn to specify and interpret a joint NMF model that represents common sample structure separately from patterns confined to individual omics modalities.

Advanced 11 min read

What You'll Learn

  • Write reconstruction equations for shared and modality-specific NMF components.
  • Track the dimensions and nonnegativity constraints on every factor matrix.
  • Distinguish a shared score pattern from a modality-specific contribution.
  • Derive a conditional update for a shared sample score.
  • Check whether the data alignment and modeling assumptions support the decomposition.
  • Recognize overlap, scale ambiguity, and other limits on interpretation.

Why Separate Shared and Modality-Specific Components?

Two omics modalities measured on the same samples can contain both common and distinct structure. For example, a sample-level pattern may be reflected in both a transcriptomic block and a metabolomic block, while another pattern may occur only in the transcriptomic measurements. A joint nonnegative matrix factorization (NMF) can represent these possibilities separately rather than requiring every component to explain every modality.

The key modeling distinction is between shared sample scores, which contribute to the reconstruction of multiple modalities, and modality-specific sample scores, which contribute only to their own modality. These are model components, not proof that a biological mechanism is shared or modality-exclusive. Their interpretation depends on the data, factorization, and assumptions.

Model and Assumptions

Suppose there are \(M\) modalities measured on the same \(n\) samples. Let \(X^{(m)}\) be the nonnegative data matrix for modality \(m\), with \(p_m\) features. Use the same row order in every matrix so that row \(i\) refers to the same sample across modalities. Choose \(K_s\) shared components and \(K_m\) modality-specific components for modality \(m\).

Definition: A shared-and-specific joint NMF represents each modality as \(X^{(m)} \approx S(H^{(m)})^T + U^{(m)}(V^{(m)})^T\). Here \(S\) is the \(n \times K_s\) shared sample-score matrix; \(H^{(m)}\) is the \(p_m \times K_s\) shared feature-loading matrix for modality \(m\); \(U^{(m)}\) is the \(n \times K_m\) modality-specific sample-score matrix; and \(V^{(m)}\) is the \(p_m \times K_m\) modality-specific feature-loading matrix. All entries of the data and factor matrices are constrained to be nonnegative.

The dimensions make the reconstruction precise: \(S(H^{(m)})^T\) and \(U^{(m)}(V^{(m)})^T\) are each \(n \times p_m\), matching \(X^{(m)}\). The same \(S\) is used across modalities, but the shared loadings \(H^{(m)}\) differ by modality. Consequently, a shared score pattern can contribute to each block through a different feature profile. In contrast, \(U^{(m)}(V^{(m)})^T\) appears only in block \(m\).

A common fitting criterion is a weighted sum of squared reconstruction errors:

$$ \min_{\substack{S,H^{(m)},U^{(m)},V^{(m)} \geq 0}} \frac{1}{2}\sum_{m=1}^{M} w_m \left\|X^{(m)}-S(H^{(m)})^T-U^{(m)}(V^{(m)})^T\right\|_F^2, \qquad w_m>0. $$

The Frobenius norm squared is the sum of squared entries in a matrix. The positive block weights \(w_m\) determine how strongly each modality’s reconstruction error contributes to the joint objective; their choice matters when blocks differ in scale. This tutorial focuses on the structure of the shared and specific factors, not on deriving block weights.

The model assumes nonnegative input values, aligned samples, and an additive representation in which the indicated components can approximate each block. The squared-error objective is appropriate when squared deviations are a reasonable fitting criterion. It does not itself assert a probability distribution for the data. If a modality contains negative values, if samples are not matched, or if its measurement scale makes squared error unsuitable, this formulation needs reconsideration. Rank choices and preprocessing also affect what patterns can be represented.

Reading the Reconstruction

For a particular sample \(i\) and feature \(j\) in modality \(m\), the fitted value is

$$ \widehat{x}_{ij}^{(m)} = \sum_{k=1}^{K_s} S_{ik}H_{jk}^{(m)} + \sum_{\ell=1}^{K_m} U_{i\ell}^{(m)}V_{j\ell}^{(m)}. $$

Each product pairs a sample score with a feature loading. A large score indicates that a component contributes strongly for that sample, while the loading determines which features receive that contribution and by how much. Since the factors are nonnegative, the model adds contributions; it does not represent a component subtracting from another component.

Worked Example: Reconstructing Two Modalities

Consider two samples and two modalities. Modality 1 has two features, and modality 2 has one. Let there be one shared component and one specific component in each modality:

$$ S=\begin{bmatrix}2\\1\end{bmatrix},\quad H^{(1)}=\begin{bmatrix}1\\0.5\end{bmatrix},\quad U^{(1)}=\begin{bmatrix}0\\1\end{bmatrix},\quad V^{(1)}=\begin{bmatrix}0.5\\1\end{bmatrix}; \qquad H^{(2)}=\begin{bmatrix}2\end{bmatrix},\quad U^{(2)}=\begin{bmatrix}1\\0\end{bmatrix},\quad V^{(2)}=\begin{bmatrix}1\end{bmatrix}. $$

For modality 1, the shared reconstruction is \(S(H^{(1)})^T=\begin{bmatrix}2&1\\1&0.5\end{bmatrix}\). The specific reconstruction is \(U^{(1)}(V^{(1)})^T=\begin{bmatrix}0&0\\0.5&1\end{bmatrix}\). Adding them gives \(\widehat{X}^{(1)}=\begin{bmatrix}2&1\\1.5&1.5\end{bmatrix}\). For example, the fitted value for sample 2 and feature 1 is \(1(1)+1(0.5)=1.5\).

For modality 2, the shared reconstruction is \(S(H^{(2)})^T=\begin{bmatrix}4\\2\end{bmatrix}\), and the specific reconstruction is \(U^{(2)}(V^{(2)})^T=\begin{bmatrix}1\\0\end{bmatrix}\). Thus \(\widehat{X}^{(2)}=\begin{bmatrix}5\\2\end{bmatrix}\). The shared score values, 2 and 1, are used in both blocks. The additional contribution for sample 1 in modality 2 comes from its modality-2-specific score.

Why the Shared Score Is Estimated Jointly

The same shared score must help explain every modality. This joint constraint is the central mechanism for capturing cross-modality sample patterns. The following conditional calculation shows how evidence from multiple blocks enters one shared score. Hold all factors fixed except the score \(s_i\) for sample \(i\) in one shared component \(k\). For each modality, subtract the contributions of other components and the modality-specific part, and call the resulting residual target \(r_i^{(m)}\), a \(p_m\)-dimensional row vector. Let \(h_k^{(m)}\) be the corresponding shared loading vector.

The part of the objective involving \(s_i\) is, up to terms that do not depend on it,

$$ f(s_i)=\frac{1}{2}\sum_{m=1}^{M}w_m \left\|r_i^{(m)}-s_i(h_k^{(m)})^T\right\|_2^2,\qquad s_i\geq 0. $$

Expanding the squared norms gives a quadratic in \(s_i\). Differentiating the unconstrained quadratic and setting its derivative to zero yields the ratio below. If its numerator is negative, the minimum over \(s_i\geq 0\) occurs at the boundary \(s_i=0\). Thus, when the denominator is positive, the constrained minimizer is:

$$ f'(s_i)= s_i\sum_m w_m\|h_k^{(m)}\|_2^2 -\sum_m w_m r_i^{(m)}(h_k^{(m)})^T; \qquad s_i^*= \max\left(0,\, \frac{\sum_m w_m r_i^{(m)}(h_k^{(m)})^T} {\sum_m w_m\|h_k^{(m)}\|_2^2}\right). $$

The formula is a conditional result with the other factors held fixed, not a closed-form solution to the full joint optimization. If every shared loading vector is zero, the denominator is zero and this component cannot contribute; the ratio is undefined. Otherwise, each modality with a nonzero loading can contribute to the numerator and denominator. The shared score therefore reflects a weighted compromise across the modalities, rather than a separate score estimated independently in each block.

Worked Example: A Shared Score Combines Evidence Across Blocks

For one sample, suppose there are two modalities, each with one feature. A shared component has loadings \(h^{(1)}=1\) and \(h^{(2)}=2\). After subtracting the fixed specific and other-component contributions, the residual targets are \(r^{(1)}=3\) and \(r^{(2)}=4\). Let both block weights be 1. The conditional minimizer is

$$ s^*=\max\left(0,\frac{(3)(1)+(4)(2)}{1^2+2^2}\right) =\frac{11}{5}=2.2. $$

The shared component contributes \(2.2(1)=2.2\) to modality 1 and \(2.2(2)=4.4\) to modality 2. The specific contributions already subtracted from the targets are not part of these values. The residuals after fitting this shared component are \(3-2.2=0.8\) and \(4-4.4=-0.4\). The conditional squared-error objective is \(\frac{1}{2}(0.8^2+(-0.4)^2)=0.4\). The shared score is a compromise: setting it to 3 would match the first residual target but would predict 6 in the second modality, rather than 4.

Distinguishing Cross-Omics and Within-Modality Patterns

In this model, a shared component has one score column in \(S\) and a loading column in every modality. It can express cross-omics structure when the same sample-score pattern contributes meaningfully to multiple blocks. A modality-specific component has its own score column and loading column in one block only, so it represents additional within-modality structure by construction.

Worked Example: Identifying the Source of a Fitted Pattern

Suppose two samples have shared scores \(S=\begin{bmatrix}1\\3\end{bmatrix}\). For a one-feature modality A, let its shared loading be 2, its specific scores be \(\begin{bmatrix}0\\2\end{bmatrix}\), and its specific loading be 1. For a one-feature modality B, let its shared loading be 1 and its specific contribution be zero. The fitted values are:

$$ \widehat{X}^{(A)} = \begin{bmatrix}1\\3\end{bmatrix}(2) + \begin{bmatrix}0\\2\end{bmatrix}(1) = \begin{bmatrix}2\\8\end{bmatrix}, \qquad \widehat{X}^{(B)} = \begin{bmatrix}1\\3\end{bmatrix}(1) = \begin{bmatrix}1\\3\end{bmatrix}. $$

In modality A, the change from fitted value 2 to 8 is decomposed into a shared increase of \(3(2)-1(2)=4\) and a specific increase of \(2(1)-0(1)=2\). Modality B also has a shared increase, from 1 to 3. The score pattern in \(S\) therefore contributes to both modalities, while the extra contribution in A comes from its specific factor. These calculations describe the fitted decomposition; they do not establish the biological cause of either pattern.

Diagnostics, Alternatives, and Limitations

Before interpreting a decomposition, check that the data satisfy the model’s basic requirements. In particular, verify that matrices are nonnegative, rows refer to the same samples in the same order, factor dimensions match the chosen ranks, and the objective and block weights reflect the intended scale of comparison. A row-order mismatch can create an apparent shared pattern from unrelated samples. A block on a much larger numerical scale can dominate a weighted squared-error objective if the weights do not address that imbalance.

Useful checks include examining the reconstruction error by modality, checking whether shared and specific factors are both making nontrivial contributions, and looking for redundant or nearly duplicated score patterns. A very small specific reconstruction may indicate that the chosen specific rank is unnecessary, though the fitted result alone does not prove that. Likewise, a shared component whose loading is negligible in one block should not be described as a strong cross-omics pattern simply because its score column exists in \(S\). Detailed residual assessment and component stability require additional analyses.

The main alternative is a joint NMF with shared sample scores only, \(X^{(m)}\approx S(H^{(m)})^T\). It imposes a more restrictive structure: every modeled sample pattern must be represented through the shared score matrix. Adding specific components relaxes that restriction, but introduces more parameters and potential overlap between the shared and specific parts. Separate NMF fits for each modality are another alternative. They allow each block to have its own scores, but do not directly constrain any score pattern to be shared across blocks. The choice depends on whether common sample structure is a target of the analysis and whether the data support a joint representation.

ModelScore structureMain trade-off
Shared-only joint NMFOne shared score matrix across modalitiesCompact, but cannot add an explicit modality-specific score contribution
Shared-and-specific joint NMFShared scores plus separate specific scores for each modalityDistinguishes common from within-block contributions, with added complexity and possible overlap
Separate NMF by modalityEach modality has its own scoresFlexible within blocks, but no shared-score constraint

As with NMF generally, the factors need not be uniquely determined. Rescaling a score column and inversely rescaling its loading column can preserve the product. Components can also be permuted without changing the reconstruction. More fundamentally, similar patterns may be explained by either shared or specific terms unless the fitted structure and data clearly distinguish them. Nonnegativity alone does not guarantee that the decomposition reflects scientifically meaningful categories.

Common Mistake

Wrong reasoning: “A component is shared because I can see a similar feature pattern in two separate NMF fits.” Separate fits do not impose a common score matrix, and component order or scale may differ between fits. Similar-looking results are not the same as a shared component in a joint model.

Correction: In this model, sharing is defined by the common matrix \(S\) appearing in the reconstruction equations for multiple modalities. Assess how that shared contribution enters each block, and distinguish it from the modality-specific term. Even then, “shared” describes the fitted representation; it does not, by itself, imply a shared causal process.

Key takeaway: Shared scores \(S\) provide a common sample coordinate system across modalities, while \(U^{(m)}\) adds sample structure unique to modality \(m\). The two terms separate contributions in the reconstruction, but their scientific interpretation requires checking the fit, assumptions, and possible factor overlap.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. If \(S\) is \(n \times K_s\) and \(H^{(m)}\) is \(p_m \times K_s\), what are the dimensions of \(S(H^{(m)})^T\)?
  2. What feature of the equations makes a score pattern shared rather than modality-specific?
  3. For one modality, suppose a sample has shared score 2 and shared loading 3 for a component, plus specific score 1 and specific loading 4. What is the fitted value from these two terms?
  4. Why can a shared component with a nearly zero loading in one modality be weak evidence for a cross-omics pattern in that modality?
  5. What is a consequence of fitting separate NMF models instead of using one shared score matrix?

Solutions. (1) \(n \times p_m\), so the product has the same dimensions as the modality’s data matrix. (2) The same score matrix \(S\) appears in multiple modality reconstruction equations; a specific score matrix \(U^{(m)}\) appears only in its own modality. (3) The contribution is \(2(3)+1(4)=10\). (4) The shared score is multiplied by that modality’s loading, so a nearly zero loading produces a nearly zero shared contribution there. (5) Separate models do not impose a common score pattern across modalities, so their scores are not directly constrained to represent shared sample structure.

Clinical Biostats