Tutorials › Multi-Omics Data Integration › Deriving Frobenius Multiplicative Updates

Non-Negative Matrix Factorization · Tutorial 189 of 597

Deriving Frobenius Multiplicative Updates

Learn how the Frobenius loss yields multiplicative updates for both NMF factors, when the formulas are defined, and how to check a numerical update.

Advanced 11 min read

What You'll Learn

  • Write the Frobenius reconstruction loss for a nonnegative data matrix and its two factor matrices.
  • Derive the gradients with respect to W and H while holding the other factor fixed.
  • Connect the gradient decomposition and KKT stationarity to the multiplicative update formulas.
  • Apply the updates elementwise and distinguish updating W from updating H.
  • Identify denominator, initialization, and interpretation issues that can make an update unreliable.
  • Compare multiplicative updates with gradient-based and block least-squares alternatives.

From Reconstruction Error to an Update

Non-negative matrix factorization (NMF) represents a nonnegative data matrix \(V\) approximately as the product of two nonnegative factors, \(W\) and \(H\). The Frobenius multiplicative updates turn the reconstruction objective into simple elementwise rescalings. Their derivation matters: the numerator and denominator are determined by the gradient, and the formulas apply only when their denominators are well-defined.

Let \(V\) have \(m\) rows and \(n\) columns, and choose a factorization rank \(r\). Thus \(W\) is \(m\times r\), \(H\) is \(r\times n\), and \(WH\) approximates \(V\). The entries of \(V\), \(W\), and \(H\) are assumed to be finite and nonnegative. With one factor held fixed, the Frobenius objective is a differentiable least-squares function of the other factor; jointly, it is generally nonconvex.

Definition: The Frobenius NMF objective is \(F(W,H)=\frac{1}{2}\lVert V-WH\rVert_F^2\), minimized subject to \(W\geq 0\) and \(H\geq 0\). The Frobenius norm squared is the sum of the squared entries: \(\lVert V-WH\rVert_F^2=\sum_{i=1}^{m}\sum_{j=1}^{n}(V_{ij}-(WH)_{ij})^2\). The factor \(1/2\) simplifies the gradient and does not change the minimizers.

The multiplicative formulas are applied in alternating blocks: first update \(W\) with the current \(H\) fixed, then update \(H\) using the updated \(W\). All matrix products inside each ratio are ordinary matrix products. The division and multiplication between corresponding entries are elementwise.

Gradients and the KKT Connection

For fixed \(H\), differentiating the objective with respect to \(W\) gives \(WHH^{T}-VH^{T}\). For fixed \(W\), the gradient with respect to \(H\) is \(W^{T}WH-W^{T}V\). Each gradient has a nonnegative term and a subtracted nonnegative term when the factors and data are nonnegative.

$$ \nabla_W F = WHH^{T}-VH^{T}, \qquad \nabla_H F = W^{T}WH-W^{T}V. $$

These gradients follow by differentiating the squared residual, or by expanding the loss and collecting terms. For example, as a function of \(W\), the terms that depend on \(W\) are \(\frac{1}{2}\operatorname{tr}(W^{T}WHH^{T})-\operatorname{tr}(W^{T}VH^{T})\). Differentiating these terms gives \(WHH^{T}-VH^{T}\). The corresponding expansion in \(H\) gives the second gradient above.

The KKT conditions for a nonnegative minimization problem require a zero gradient at a strictly positive coordinate; at a coordinate equal to zero, the gradient must be nonnegative. In the positive interior, setting the gradients to zero gives the balance between the two nonnegative terms. The multiplicative updates use this balance to rescale each current entry by the ratio of its subtracted gradient term to its other term.

$$ W_{ik}\leftarrow W_{ik} \frac{(VH^{T})_{ik}}{(WHH^{T})_{ik}}, \qquad H_{kj}\leftarrow H_{kj} \frac{(W^{T}V)_{kj}}{(W^{T}WH)_{kj}}. $$

In the \(W\) formula, \(H\) is held fixed. In the \(H\) formula, \(W\) is held fixed; in an alternating iteration, use the newly updated \(W\). A zero gradient at a positive entry means numerator and denominator agree there, so the corresponding ratio is one. This explains the stationary-point motivation for the formulas. It does not make either formula a direct solution of the whole joint optimization problem.

A useful equivalent view is a diagonally scaled gradient step. For example, the \(W\) update is \(W_{ik}-(W_{ik}/(WHH^{T})_{ik})(\nabla_W F)_{ik}\), when the denominator is positive. Substituting the gradient simplifies this expression to the multiplicative ratio. This representation explains the algebra, but by itself is not a proof of convergence or of decrease in the objective.

Worked Example: A Scalar Update for W

Take a hypothetical one-entry problem with \(V=[6]\), \(W=[2]\), and \(H=[2]\). The reconstruction is \(WH=4\), so the residual is \(6-4=2\). The objective is \(F=\frac{1}{2}(6-4)^2=2\). Holding \(H\) fixed, the gradient with respect to \(W\) is \((WH-V)H=(4-6)(2)=-4\).

The multiplicative update has numerator \(VH^{T}=6(2)=12\) and denominator \(WHH^{T}=2(2)(2)=8\). Therefore,

$$ W_{\mathrm{new}}=2\left(\frac{12}{8}\right)=3. $$

The denominator is positive, and both the data and factors are nonnegative, so the update is defined and remains nonnegative. Here the updated reconstruction is \(3(2)=6\), matching the single data entry. This convenient outcome is specific to this scalar example; it is not a general guarantee that one update gives an exact reconstruction.

Matrix Updates Worked Through

For a matrix update, it is useful to compute the numerator and denominator separately, check their dimensions, and then apply the ratio entry by entry. If \(V\) is \(m\times n\), then \(VH^{T}\) and \(WHH^{T}\) are both \(m\times r\), matching \(W\). Likewise, \(W^{T}V\) and \(W^{T}WH\) are both \(r\times n\), matching \(H\).

Worked Example: One Alternating Update on a 2-by-2 Matrix

Suppose the hypothetical data matrix and initial factors are

$$ V=\begin{bmatrix}2&1\\1&2\end{bmatrix}, \qquad W=\begin{bmatrix}1\\1\end{bmatrix}, \qquad H=\begin{bmatrix}1&1\end{bmatrix}. $$

All entries are nonnegative. First update \(W\), holding \(H\) fixed. The numerator is \(VH^{T}=[3,3]^{T}\). Since \(HH^{T}=[2]\), the denominator is \(W(HH^{T})=[2,2]^{T}\). Thus each entry of \(W\) is multiplied by \(3/2\):

$$ W_{\mathrm{new}} = \begin{bmatrix}1\\1\end{bmatrix} \odot \frac{\begin{bmatrix}3\\3\end{bmatrix}} {\begin{bmatrix}2\\2\end{bmatrix}} = \begin{bmatrix}1.5\\1.5\end{bmatrix}. $$

Now update \(H\), using \(W_{\mathrm{new}}\). The numerator is \(W_{\mathrm{new}}^{T}V=[4.5,4.5]\). The scalar \(W_{\mathrm{new}}^{T}W_{\mathrm{new}}=1.5^2+1.5^2=4.5\), so the denominator is \([4.5,4.5]\). Consequently,

$$ H_{\mathrm{new}} = \begin{bmatrix}1&1\end{bmatrix} \odot \frac{\begin{bmatrix}4.5&4.5\end{bmatrix}} {\begin{bmatrix}4.5&4.5\end{bmatrix}} = \begin{bmatrix}1&1\end{bmatrix}. $$

The updated approximation is \(W_{\mathrm{new}}H_{\mathrm{new}}=\begin{bmatrix}1.5&1.5\\1.5&1.5\end{bmatrix}\). Its residual, defined as \(V-W_{\mathrm{new}}H_{\mathrm{new}}\), is \(\begin{bmatrix}0.5&-0.5\\-0.5&0.5\end{bmatrix}\). This calculation illustrates the full sequence and the residual convention; it does not establish a general property of the objective across iterations.

Worked Example: Updating H for a Rank-Two Factorization

Consider the hypothetical matrices

$$ V=\begin{bmatrix}3&2&2\\4&3&3\end{bmatrix}, \quad W=\begin{bmatrix}1&1\\2&1\end{bmatrix}, \quad H=\begin{bmatrix}1&2&1\\1&1&2\end{bmatrix}. $$

We update \(H\) with \(W\) fixed. First, \(W^{T}V=\begin{bmatrix}11&8&8\\7&5&5\end{bmatrix}\). Also, \(W^{T}W=\begin{bmatrix}5&3\\3&2\end{bmatrix}\), giving

$$ W^{T}WH = \begin{bmatrix}5&3\\3&2\end{bmatrix} \begin{bmatrix}1&2&1\\1&1&2\end{bmatrix} = \begin{bmatrix}8&13&11\\5&8&7\end{bmatrix}. $$

Both matrices in the ratio are \(2\times3\), as required for an elementwise update of \(H\). The denominators are all positive. Applying the ratio to each current entry gives

$$ H_{\mathrm{new}} = \begin{bmatrix} 1(11/8)&2(8/13)&1(8/11)\\ 1(7/5)&1(5/8)&2(5/7) \end{bmatrix} \approx \begin{bmatrix} 1.375&1.231&0.7273\\ 1.400&0.6250&1.429 \end{bmatrix}. $$

For instance, the updated entry in row 1, column 2 is \(2(8/13)=16/13\approx1.231\). The calculation uses the original \(H\) in the numerator and denominator and changes each entry according to the same formula. The updated entries are all nonnegative.

Conditions, Diagnostics, and Alternatives

The data must be nonnegative for the stated nonnegative factorization model, and all entries being updated must have positive denominators. Strictly positive initial factors are a sufficient condition for positive denominators when the matrices have nonzero dimensions. If a denominator is zero, the displayed ratio is undefined; the formula must not be applied blindly. Implementations need to detect such cases and use a suitable safeguard or initialization strategy.

For a reliable calculation, check that the products have the expected dimensions, that numerator and denominator entries are nonnegative, and that each denominator used is positive. After an update, verify that the factors remain nonnegative and that the residual \(V-WH\) is computed in the stated order. For a numerical implementation, monitor the objective and inspect whether values become non-finite or the factors become numerically extreme. Such checks can reveal programming errors, poor numerical behavior, or a mismatch between the data and the assumed objective.

The updates are motivated by the gradient decomposition and KKT stationarity, but those facts do not imply that the joint problem is convex or that a particular result is a global minimum. Different starting factors may lead to different outcomes. Moreover, the ratio formulas are not the only way to handle the nonnegativity constraints. Projected gradient methods use gradient steps followed by constraint handling, while alternating nonnegative least squares focuses on block subproblems. These are alternatives, not additional steps in the multiplicative derivation.

A common mistake is to treat the numerator and denominator as interchangeable gradient terms and update \(H\) using an old \(W\) after the intended alternating step has already updated \(W\). The correction is to follow the declared sequence: compute and apply the \(W\) update with \(H\) fixed; then recompute the \(H\) numerator and denominator using the new \(W\). Another mistake is to claim that a stationary-point argument proves an update decreases the objective. The gradient/KKT connection motivates the formula, but a separate argument is needed for claims about objective behavior.

Key takeaway: For the Frobenius objective, split each gradient into its nonnegative reconstruction term minus its nonnegative data term, then multiply each factor entry by the ratio of data term to reconstruction term. Check dimensions and positive denominators, and apply the \(W\) and \(H\) updates in the specified alternating order.

Check Your Understanding

Try each question, then compare your reasoning with the solutions below.

  1. For fixed \(W\), what is the gradient of the Frobenius objective with respect to \(H\)?
  2. In a one-entry problem with \(V=10\), \(W=2\), and \(H=3\), calculate the multiplicative update for \(W\), holding \(H\) fixed.
  3. For a one-entry problem with \(V=6\), \(W=1\), and \(H=2\), calculate the multiplicative update for \(H\), holding \(W\) fixed.
  4. Why must the dimensions of \(W^{T}V\) and \(W^{T}WH\) match before applying the \(H\) update?
  5. What should be checked if a denominator in one of the update ratios is zero?

Solutions. (1) \(\nabla_H F=W^{T}WH-W^{T}V\). (2) The numerator is \(VH=10(3)=30\), and the denominator is \(WH^2=2(3^2)=18\), so \(W_{\mathrm{new}}=2(30/18)=10/3\approx3.333\). (3) The numerator is \(WV=1(6)=6\), and the denominator is \(W^2H=1^2(2)=2\), so \(H_{\mathrm{new}}=2(6/2)=6\). (4) Both products must be \(r\times n\), the shape of \(H\), so corresponding entries can be divided and multiplied. (5) The ratio is undefined, so confirm the calculation and initialization and use an implementation safeguard rather than applying the formula as written.

Clinical Biostats