Tutorials › Multi-Omics Data Integration › Deriving Block Weights for Joint NMF

Non-Negative Matrix Factorization · Tutorial 202 of 597

Deriving Block Weights for Joint NMF

Learn to derive block weights from a target contribution for each omics modality, calculate them, and assess the assumptions and trade-offs behind common scaling choices.

Advanced 13 min read

What You'll Learn

  • Write a weighted Frobenius reconstruction objective for aligned nonnegative data blocks with shared sample scores.
  • Derive weights that give each block a specified positive share of the relative squared error.
  • Calculate block weights and objective values from hypothetical norms and residuals.
  • Explain how block dimensions, measurement scales, and units affect raw Frobenius weighting.
  • Compare relative-error weighting with per-entry and precision-based weighting.
  • Identify zero-block, near-zero-norm, and weight-selection pitfalls.

Why Joint NMF Needs Block Weights

Joint NMF uses a common sample-score matrix to represent several omics blocks. Even when every block is fitted with a Frobenius-norm reconstruction loss, simply adding the losses does not make the modalities contribute comparably. A block with more entries, larger numerical values, or larger residuals can dominate the shared scores. Block weights make this trade-off explicit.

The purpose here is to derive weights from a chosen target: how much should each block's relative squared reconstruction error count? This is one principled choice, not a universal default. It differs from weighting by measurement precision or by the number of entries, and its interpretation depends on the data scales and the modeling goal.

Definition: Suppose there are \(M\) aligned nonnegative data blocks, \(X^{(m)}\in\mathbb{R}_+^{p_m\times n}\), for \(m=1,\ldots,M\), each measured on the same \(n\) samples. In joint NMF with shared sample scores, block \(m\) is approximated by \(W^{(m)}H\), where \(W^{(m)}\in\mathbb{R}_+^{p_m\times r}\) and \(H\in\mathbb{R}_+^{r\times n}\). The weighted Frobenius reconstruction objective is \(J=\frac{1}{2}\sum_{m=1}^M\lambda_m\|X^{(m)}-W^{(m)}H\|_F^2\), with fixed \(\lambda_m>0\). The factor \(1/2\) is a convenient convention and does not change the minimizers.

The blocks must refer to the same samples in the same order for a shared \(H\) to have this interpretation. The matrices and factors are nonnegative, and the rank \(r\) is chosen in advance for this objective. The squared-error loss is appropriate when squared deviations are a meaningful measure of reconstruction discrepancy. A Gaussian-error motivation is possible, but only with additional assumptions; the weighted objective alone does not establish that the residuals are independent Gaussian errors or that \(\lambda_m\) are inverse variances.

Deriving Weights for Relative Reconstruction Error

For a nonzero block, define its relative squared reconstruction error as the squared residual norm divided by the squared norm of the observed block. This dimensionless quantity measures residual size relative to the block's overall scale. Let \(\alpha_m\) specify the desired importance of that relative error. To keep every block active under the objective's positive-weight convention, require \(\alpha_m>0\) for all \(m\), with \(\sum_{m=1}^M\alpha_m=1\). Also require \(\|X^{(m)}\|_F>0\) for every block.

$$ e_m=\frac{\|X^{(m)}-W^{(m)}H\|_F^2}{\|X^{(m)}\|_F^2}, \qquad J_{\mathrm{rel}}=\frac{1}{2}\sum_{m=1}^M\alpha_m e_m. $$

Match the weighted Frobenius objective to this target term by term. The coefficient multiplying the residual norm squared in \(J_{\mathrm{rel}}\) must be \(\alpha_m/\|X^{(m)}\|_F^2\). Therefore the block weight is:

$$ \lambda_m=\frac{\alpha_m}{\|X^{(m)}\|_F^2}, \qquad J=\frac{1}{2}\sum_{m=1}^M \frac{\alpha_m}{\|X^{(m)}\|_F^2} \|X^{(m)}-W^{(m)}H\|_F^2 =\frac{1}{2}\sum_{m=1}^M\alpha_m e_m. $$

This is an identity, not an approximation: with these fixed weights, each block's contribution to the objective is exactly one half of its assigned importance times its relative squared error. Equal \(\alpha_m\) values give equal importance to relative errors, not equal importance to absolute residual sums. Other positive \(\alpha_m\) values encode a deliberate priority, and must be chosen before interpreting the fitted solution.

Derivation: For each nonzero block, \(e_m=\|X^{(m)}-W^{(m)}H\|_F^2/\|X^{(m)}\|_F^2\). Substituting this into the target objective gives \(J_{\mathrm{rel}}=\frac{1}{2}\sum_m [\alpha_m/\|X^{(m)}\|_F^2]\|X^{(m)}-W^{(m)}H\|_F^2\). Comparing with \(J=\frac{1}{2}\sum_m\lambda_m\|X^{(m)}-W^{(m)}H\|_F^2\) yields \(\lambda_m=\alpha_m/\|X^{(m)}\|_F^2\). Since \(\alpha_m>0\) and the block norm is positive, each \(\lambda_m>0\), as required.

Weights also determine how each modality's residual affects the common score matrix. Differentiating the objective with respect to \(H\), while holding the \(W^{(m)}\) fixed, gives a sum of block-specific gradient contributions:

$$ \nabla_H J=\sum_{m=1}^M\lambda_m(W^{(m)})^\mathsf{T} \bigl(W^{(m)}H-X^{(m)}\bigr). $$

Thus, changing a block weight changes its contribution to the optimization of the shared scores. It does not merely change the printed value of the loss. The derivative follows by expanding each squared Frobenius norm as a trace, differentiating the quadratic in \(H\), and using that the derivative of \(\frac{1}{2}\|W^{(m)}H-X^{(m)}\|_F^2\) is \((W^{(m)})^\mathsf{T}(W^{(m)}H-X^{(m)})\). Nonnegativity constraints still apply to both factors; this gradient expression does not itself specify a constrained optimization algorithm.

Worked Example: Equal Importance for Two Blocks

Suppose two hypothetical aligned blocks have \(\|X^{(1)}\|_F=10\) and \(\|X^{(2)}\|_F=20\). At a candidate joint fit, their residual norms are respectively \(2\) and \(6\). Choose equal importance, \(\alpha_1=\alpha_2=0.5\). Both observed blocks are nonzero, so the relative-error weighting formula applies.

The squared norms are \(100\) and \(400\), and the squared residual norms are \(4\) and \(36\). Hence the relative squared errors are \(e_1=4/100=0.04\) and \(e_2=36/400=0.09\). The weights are:

$$ \lambda_1=\frac{0.5}{100}=0.005, \qquad \lambda_2=\frac{0.5}{400}=0.00125. $$

Substitution into the objective gives \(J=\frac{1}{2}[0.005(4)+0.00125(36)]=\frac{1}{2}(0.02+0.045)=0.0325\). Equivalently, \(J=\frac{1}{2}[0.5(0.04)+0.5(0.09)]=0.0325\). Block 2 has the larger relative error, so its contribution to this objective is larger despite its smaller numerical weight. The weights compensate for the different observed-block scales.

Scaling Choices and Their Consequences

Unweighted reconstruction, \(\lambda_m=1\), gives each block a contribution proportional to its absolute squared residual norm. It can be reasonable when absolute discrepancies are comparable across blocks and their units and scales are meaningfully commensurate. But a large block norm may arise from having many features, larger measurements, or both. Then raw Frobenius loss may emphasize that block even if its relative fit is no better.

Relative-error weighting divides by the total squared norm of each block. It does not divide by the number of entries. A different choice, \(\lambda_m=1/(p_m n)\), weights the mean squared residual per entry equally across blocks. That can address block-size differences but does not adjust for different measurement scales. A precision-based choice instead uses weights motivated by residual variability: under a suitable independent Gaussian residual model with common variance within block \(m\), inverse-variance weights are proportional to \(1/\sigma_m^2\). This has a statistical interpretation only if the error model is defensible and variance estimates are appropriate. It is not generally the same as normalizing by \(\|X^{(m)}\|_F^2\).

Worked Example: Giving the First Block More Importance

Consider hypothetical blocks with squared Frobenius norms \(900\) and \(100\), and candidate squared residual norms \(36\) and \(10\). Choose positive relative-error importances \(\alpha_1=0.7\) and \(\alpha_2=0.3\), which sum to one. Both observed blocks are nonzero, and the residual norms are consistent with the stated candidate fit.

The relative squared errors are \(e_1=36/900=0.04\) and \(e_2=10/100=0.10\). The corresponding weights are \(\lambda_1=0.7/900\approx0.0007778\) and \(\lambda_2=0.3/100=0.003\). Therefore:

$$ J=\frac{1}{2}\bigl[0.0007778(36)+0.003(10)\bigr] \approx\frac{1}{2}(0.028+0.030)=0.029. $$

The same result follows from \(J=\frac{1}{2}[0.7(0.04)+0.3(0.10)]=0.029\). Although block 1 has a smaller relative error, its weighted contribution is \(0.014\), compared with \(0.015\) for block 2. The chosen importances do not guarantee that block 1 contributes more at every fitted solution; its actual contribution also depends on its relative error.

A useful invariance clarifies the role of normalization. If every entry of block \(m\) is multiplied by a positive constant \(c\), its squared norm and squared residual norm both multiply by \(c^2\), provided its reconstruction is scaled consistently. Its relative squared error is unchanged. Its corresponding \(\lambda_m\) becomes \(\lambda_m/c^2\), so the weighted residual contribution remains unchanged. Raw unweighted loss does not have this property: changing units can alter the relative influence of a block on the shared factors.

Worked Example: Rescaling a Block Without Changing Its Relative Contribution

Suppose block 1 has squared norm \(25\), squared residual norm \(4\), and importance \(0.4\). Block 2 has squared norm \(100\), squared residual norm \(9\), and importance \(0.6\). Each observed block is nonzero. The weights are \(\lambda_1=0.4/25=0.016\) and \(\lambda_2=0.6/100=0.006\), giving:

$$ J=\frac{1}{2}[0.016(4)+0.006(9)] =\frac{1}{2}(0.064+0.054)=0.059. $$

Now express block 2 in units twice as large, multiplying its data and its reconstruction by \(2\). Its squared norm becomes \(400\), and its squared residual norm becomes \(36\). The relative error remains \(36/400=0.09\), while its new weight is \(0.6/400=0.0015\). Its weighted contribution remains \(0.0015(36)=0.054\), so the objective is still \(0.059\). This invariance holds for this unit conversion when the reconstruction is transformed consistently; it does not imply that arbitrary preprocessing leaves the fitted factors unchanged.

Assumptions, Diagnostics, and Limitations

Before applying relative-error weights, verify that the blocks contain the same samples in a matched order, are represented on scales appropriate for a nonnegative factorization, and have nonzero Frobenius norms. The importances should be strictly positive for the formula above and for the objective convention \(\lambda_m>0\). If a block is identically zero, its relative error is undefined; remove it as uninformative for this criterion or define another objective rather than dividing by zero. If an importance is set to zero in an alternative formulation that permits \(\lambda_m\geq0\), that block is excluded from the criterion and no longer influences the fit.

Check the actual weighted contributions \(\frac{1}{2}\lambda_m\|X^{(m)}-W^{(m)}H\|_F^2\), not only the raw residual norms. Also check each relative error and the selected weights. A very small observed-block norm can produce a very large weight for a given importance, making the objective sensitive to modest absolute residuals. A large weight is not automatically a numerical error, but it warrants checking the block scale, preprocessing, and intended meaning of relative error.

The choice \(\lambda_m=\alpha_m/\|X^{(m)}\|_F^2\) has limitations. A single block-wide norm can conceal feature-specific scales, sparsity, or noise differences. Squared error is sensitive to large residuals, and equal relative-error importance may not be scientifically appropriate. Weights and importances are modeling decisions, not facts inferred by the formula. Report them, explain their rationale, and examine whether conclusions are sensitive to reasonable alternatives. Weight selection is distinct from choosing a rank or deciding how to represent shared and modality-specific structure.

Key takeaway: If every nonzero block should contribute according to its relative squared reconstruction error, choose \(\alpha_m>0\), \(\sum_m\alpha_m=1\), and \(\lambda_m=\alpha_m/\|X^{(m)}\|_F^2\). This makes the objective's block contributions explicit; it does not make that weighting universally optimal.

Check Your Understanding

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

  1. A block has squared norm \(64\), and its assigned importance is \(0.25\). What weight does relative-error weighting assign?
  2. Two blocks have relative squared errors \(0.02\) and \(0.08\), with importances \(0.75\) and \(0.25\). Calculate the total objective under the relative-error formula.
  3. Why does using equal weights \(\lambda_m=1\) not generally give equal relative-error importance to blocks of different scales?
  4. What happens to a block's relative-error contribution if its data and reconstruction are both converted to units twice as large?
  5. A block has zero Frobenius norm. Can the relative-error formula be used as written? State a suitable response.

Solutions. (1) \(\lambda=0.25/64=0.00390625\), approximately \(0.003906\). (2) \(J=\frac{1}{2}[0.75(0.02)+0.25(0.08)]=\frac{1}{2}(0.015+0.020)=0.0175\). (3) Equal raw weights multiply absolute residual sums equally, but relative errors divide those sums by different squared block norms; thus their contributions per unit relative error differ. (4) Both squared norms multiply by \(4\), while the weight divides by \(4\), so the weighted contribution is unchanged. (5) No: the denominator is zero, so relative error is undefined. Remove the uninformative zero block from this criterion or specify a different, well-defined objective.

Clinical Biostats