Tutorials › Multi-Omics Data Integration › Assessing NMF Component Stability

Non-Negative Matrix Factorization · Tutorial 211 of 597

Assessing NMF Component Stability

Assess whether NMF components reproduce across subject resamples and repeated starts by matching components and evaluating their profiles and sample scores separately.

Advanced 12 min read

What You'll Learn

  • Distinguish variation from resampling subjects from variation due to random initialization.
  • Explain why components must be matched and scaled consistently before comparison.
  • Calculate profile similarity using cosine similarity and score similarity using correlation.
  • Summarize profile and score stability separately across repeated NMF fits.
  • Diagnose instability and distinguish reproducibility from biological validity.
  • Compare resampling and repeated-start stability checks and recognize their limitations.

Why Component Stability Needs More Than One Check

An NMF fit can describe the observed data well and still be hard to reproduce. Small changes in the subjects included, or in the algorithm’s random starting values, may yield different component profiles or assign subjects different component scores. Stability assessment asks whether the fitted patterns persist under specified perturbations. It is a reproducibility check, not a test that a component is biologically true.

The earlier material on Scale and Permutation Indeterminacy in NMF established that component labels and scales are not intrinsically fixed. Consequently, comparing component 1 from one fit with component 1 from another fit before resolving these indeterminacies can produce misleading instability. This tutorial sets out a practical comparison: match components, then summarize feature-profile reproducibility separately from sample-score reproducibility.

Definition: For a nonnegative data matrix \(X\) with \(n\) subjects and \(p\) features, write an NMF fit of rank \(K\) as \(X \approx WH\), where \(W\) is an \(n \times K\) nonnegative score matrix and \(H\) is a \(K \times p\) nonnegative profile matrix. Row \(k\) of \(H\) describes component \(k\)'s feature profile; column \(k\) of \(W\) gives subjects' scores on that component. Component stability describes the reproducibility of such components across refits under a stated perturbation, assessed separately for profiles and scores.

For multiple omics blocks, the same logic applies when a model specifies shared subject scores and block-specific feature profiles. Comparisons must use the same feature definitions, preprocessing, block weighting, and component interpretation across fits. If a feature is absent from a resampled fit or the block scales change, a raw similarity value may not be comparable across runs.

Designing the Stability Assessment

There are two useful perturbations. Repeated initializations fit the same subjects and features using different starting values, with the same rank, objective, constraints, and stopping rules. This checks sensitivity to algorithmic starts. Subject resampling refits the model on subsets or bootstrap samples of subjects, keeping the feature space and modeling choices fixed. This checks whether the inferred patterns depend strongly on which subjects are observed.

The comparison requires a common basis. Use a fixed rank \(K\), identical feature preprocessing and objective, and a prespecified resampling scheme. For subject resamples, compare profiles across all features in the common feature space. Compare scores only for subjects present in both fits, or score a common set of subjects using a consistent projection procedure. If bootstrapping duplicates subjects, retain subject identities so that matched observations are handled explicitly rather than treated as new, unrelated people.

Before measuring similarity, put profiles on a common scale. For nonzero nonnegative profile row \(h_k\), one option is \(h_k/\lVert h_k\rVert_2\), where \(\lVert h_k\rVert_2\) is its Euclidean norm. This removes arbitrary positive scaling, leaving the relative feature pattern. For scores, Pearson correlation is useful when the question concerns relative ordering across subjects and score magnitude or offset may differ. Cosine similarity is another choice when direction through the origin is the relevant comparison. The choice must be stated because these quantities answer different questions.

Definition: The cosine similarity between nonzero profile vectors \(h_a\) and \(h_b\) is \(\operatorname{cos}(h_a,h_b)=\frac{h_a^\mathsf{T}h_b}{\lVert h_a\rVert_2\lVert h_b\rVert_2}\). It lies between 0 and 1 for nonnegative vectors. The Pearson correlation between two score vectors is their centered cross-product divided by the product of their centered Euclidean norms; it measures linear association after subtracting each vector's mean.

Components are generally permuted between fits. Construct a \(K \times K\) similarity matrix between the reference fit's components and those of the new fit. Pair components so that the total similarity is as large as possible, using the profile similarity as the matching criterion when profiles are the primary object of interest. Each component should be used in at most one pair. If the task is only a stability summary, it is enough to state this one-to-one matching rule; detailed matching algorithms are a separate topic. After matching, report both profile and score similarities. A good profile match does not guarantee stable subject scores.

Worked Example: Comparing Two Component Profiles

Suppose a reference component has profile \(h_a=(1,3,0)\), while a component from a refit has profile \(h_b=(0.6438,2.8854,0)\). These are hypothetical feature weights on the same three features. Their dot product is approximately \(1(0.6438)+3(2.8854)=9.300\). The squared norms are \(1^2+3^2=10\) and, using the unrounded second vector, \(8.74\).

The profile cosine is therefore

$$ \operatorname{cos}(h_a,h_b) = \frac{9.3}{\sqrt{10}\sqrt{8.74}} = \frac{9.3}{\sqrt{87.4}} \approx \frac{9.3}{9.349} \approx 0.995 $$

The profiles point in nearly the same direction, indicating a strong relative-pattern match. The denominator is \(\sqrt{87.4}\), approximately \(9.349\); using a different rounded denominator can introduce avoidable arithmetic error. The high cosine does not establish that the component is meaningful, only that these two fitted profiles are similar under this metric.

Summarizing Profiles and Scores Separately

After matching, compute a profile similarity for each matched pair and a score similarity for each pair. Across \(R\) refits, report the distribution of these values, such as the median and range or interquartile range. Also report how often each reference component could be matched with adequate similarity. A single average can conceal a component that is stable in most fits but fails in a few.

For profile comparisons, cosine similarity focuses on the relative feature pattern and is invariant to positive rescaling. For score comparisons, Pearson correlation focuses on whether subjects tend to be high or low on a component in a similar way. Use the same subjects in each paired score comparison, and state how many were shared. If a component is absent, nearly zero, or unmatched in some fits, do not silently omit those failures: report the rate of such events and the rule used to identify them.

Worked Example: Score Reproducibility on Shared Subjects

Two matched component score vectors for four hypothetical shared subjects are \(u=(2.5,1.5,0.5,-0.5)\) and \(v=(4.4,3.4,2.6,1.6)\). Their means are \(\bar{u}=1.0\) and \(\bar{v}=3.0\). The centered vectors are \((1.5,0.5,-0.5,-1.5)\) and \((1.4,0.4,-0.4,-1.4)\).

The centered cross-product is \(2.1+0.2+0.2+2.1=4.6\). The sums of squared deviations are \(5.00\) and \(4.24\), respectively, so

$$ r = \frac{4.6}{\sqrt{5.00(4.24)}} = \frac{4.6}{\sqrt{21.2}} \approx 0.9991 $$

The two score vectors have nearly identical ordering across these four subjects. In particular, the second sum of squares is \(1.4^2+0.4^2+(-0.4)^2+(-1.4)^2=4.24\), not \(4.64\). Correlation is dimensionless and does not show that score magnitudes agree: the vectors differ in their means and scale. It is evidence of similar relative subject scores among these four shared subjects only.

Worked Example: Reporting Stability Across Resamples

Consider a hypothetical analysis with \(K=2\), five subject-resampled refits, and the same feature space in every fit. After one-to-one matching, suppose the profile cosine values for component A are \(0.96, 0.92, 0.95, 0.90, 0.97\). Their sum is \(4.70\), so their mean is \(4.70/5=0.940\), and their range is \(0.90\) to \(0.97\). Suppose the corresponding score correlations, calculated on each fit's shared subjects, are \(0.88, 0.81, 0.90, 0.76, 0.85\). Their sum is \(4.20\), so the mean is \(0.840\), and the range is \(0.76\) to \(0.90\).

A concise report would say that component A's profile was consistently similar across these five refits (mean cosine \(0.940\), range \(0.90\)–\(0.97\)), while its score association was more variable (mean correlation \(0.840\), range \(0.76\)–\(0.90\)); score comparisons used the shared subjects in each pair. These summaries describe five specified refits, not a universal guarantee. They also do not justify calling the component stable by a particular threshold unless that threshold was chosen and justified in advance.

Why the Comparison Works—and What It Cannot Establish

The normalization and similarity calculations have a direct justification. If a profile is multiplied by a positive constant \(c\), then its cosine with another profile is unchanged:

$$ \frac{(c h_a)^\mathsf{T}h_b} {\lVert c h_a\rVert_2\lVert h_b\rVert_2} = \frac{c h_a^\mathsf{T}h_b} {c\lVert h_a\rVert_2\lVert h_b\rVert_2} = \frac{h_a^\mathsf{T}h_b} {\lVert h_a\rVert_2\lVert h_b\rVert_2}, \qquad c>0. $$

Thus the cosine comparison is appropriate for profile shape despite the positive scale indeterminacy of NMF. It does not resolve permutation by itself, which is why matching is performed first. Nor does it make unlike features comparable: feature order, transformation, and block weighting must already be consistent.

Resampling stability depends on the resampling design. A small subset can omit a rare but important subject pattern; a bootstrap can include repeated copies of some subjects. Repeated initializations address a different source of variation and do not show robustness to changes in the sample. Running many starts on one data set and reporting only the best objective can hide the fact that other good fits have different components. Where possible, report stability across starts as well as across subject resamples.

Diagnostics include the distribution of matched similarities, the number of failed or ambiguous matches, and whether conclusions change under reasonable choices of similarity metric or resampling fraction. Inspect component profile plots and score scatterplots for pairs with low similarity. Check that near-zero components are not being treated as stable simply because they match another near-zero component, and that preprocessing or block-weight changes have not caused artificial disagreement. There is no universal cutoff at which a component becomes stable; thresholds depend on purpose and must be prespecified or interpreted descriptively.

Stability also differs from fit quality, rank selection, and external validation. A consistently reproduced component can reflect a systematic artifact, an imposed modeling constraint, or a broad pattern that is not specific to the scientific question. Conversely, a real but rare pattern may be unstable under ordinary resampling. Stability is most informative alongside residual diagnostics, the objective value, scientific interpretation, and independent validation when available.

Common Mistakes and Practical Alternatives

  • Comparing component labels directly. Component 1 in one fit need not correspond to component 1 in another. Match components before calculating paired similarities.
  • Using raw Euclidean distance without scale control. A pure rescaling can make identical profile shapes look far apart. Normalize profiles or use a scale-invariant measure such as cosine similarity.
  • Reporting one stability number. Profiles and scores answer different questions. Give separate summaries and specify the subjects used for score comparisons.
  • Equating stability with validity. Reproducibility across the chosen perturbations does not establish causality, biological function, or correct rank.

Alternative summaries include cosine similarity for profiles, correlation for scores, or distances after a clearly specified normalization. A consensus matrix can summarize whether pairs of subjects are repeatedly grouped together, but it answers a clustering-oriented question and does not replace profile-level comparison. A single refit on the full data is also not a stability assessment: it provides no distribution of results under perturbation. Choose measures based on the component property of interest, preserve the distinction between perturbation types, and report enough detail for the comparison to be reproduced.

Key takeaway: Assess stability only after controlling scale and matching component labels. Report profile reproducibility and score reproducibility separately, state the refitting and resampling design, and interpret stability as conditional reproducibility—not proof of truth.

Check Your Understanding

Answer each question, then check the solutions below.

  1. Why must components be matched before comparing profile similarities across NMF fits?
  2. A profile is multiplied by 5 in one fit. What happens to its cosine similarity with a fixed nonzero profile, and why?
  3. Suppose the profile cosine is 0.98 but the score correlation is 0.55. What does this suggest, and what does it not establish?
  4. Which source of variation is examined by repeated initializations, and which by subject resampling?
  5. Two centered score vectors have cross-product 6 and sums of squared deviations 9 and 16. Calculate their Pearson correlation.

Solutions. (1) NMF component labels can be permuted between fits, so identical patterns may occupy different row or column positions; one-to-one matching makes comparisons refer to corresponding components. (2) It is unchanged, because multiplying one vector by 5 multiplies both the cosine numerator and its norm denominator by 5. (3) The feature profiles are very similar in direction, while relative subject scores are less similar; this does not show that either component is valid or invalid, nor that score magnitudes agree. (4) Repeated initializations assess sensitivity to algorithmic starts on the same data; subject resampling assesses sensitivity to which subjects are included. (5) \(r=6/\sqrt{9(16)}=6/12=0.500\). The score vectors have a moderate positive linear association under this calculation.

Clinical Biostats