Alternating least squares and conditioning
Derive a CP factor update with a matching Khatri–Rao order and distinguish blockwise descent from global convergence.
On this page
The question for today
What you’ll understand
- Write an ALS matrix least-squares subproblem in the declared unfolding convention.
- Compute an exact block update and a ridge-regularized alternative.
- Explain descent, conditioning, stationarity qualifications, and diverging components.
A CP fitting objective is nonlinear in all factors together but becomes linear least squares when all except one factor are held fixed. Alternating least squares exploits this repeated simplification. Exact block solves lower the objective, yet the overall problem remains nonconvex and its factors can become badly conditioned or unbounded. Understanding the local linear systems is therefore essential before interpreting a decreasing reconstruction error as convergence to meaningful or globally optimal tensor components.
The factor update is an ordinary matrix problem
Use real factors and squared Frobenius loss one-half ||T − Σaᵣ ⊗ bᵣ ⊗ cᵣ||F². With B and C fixed, define Z = C ⊙ B, whose r-th column is cᵣ ⊗ bᵣ. This order matches our first unfolding with j varying fastest inside the combined (j, k) column. The model unfolding is AZᵀ, so updating A solves a matrix least-squares problem with one shared design Z for every row.
First-order optimality gives A(ZᵀZ) = T₍₁₎Z. If the design has full column rank, the minimizer is unique; otherwise multiple factor updates can give the same fitted block, and a pseudoinverse selects one convention. The Gram matrix equals the entrywise product of BᵀB and CᵀC. This identity can reduce computation, but it should not hide the conditioning cost of forming normal equations.
Conditioning and regularization alter the solve
For a full-column-rank design, the two-norm condition number of ZᵀZ is the square of that of Z. QR or SVD based least-squares solves can avoid explicitly squaring the conditioning in a computed Gram system. Nearly proportional factor columns often create an ill-conditioned design, even when each exact independence condition still holds. Column normalization helps control arbitrary factor scaling but cannot make genuinely dependent component information independent.
Adding λ||A||F²/2 with λ > 0 replaces the Gram matrix by ZᵀZ + λI and gives a unique regularized block update. If the full algorithm regularizes every factor, it optimizes a changed global objective, not the unregularized CP residual alone. Regularization can control component growth, at the cost of biasing the fit. Report the penalty and scaling conventions when comparing fitted components across runs.
Descent is a weaker conclusion than reliable global recovery
An exact block minimization cannot increase the current objective because the old block is feasible. The nonnegative objective values therefore converge, but that does not itself prove factor convergence, boundedness, or global optimality. If complete sweeps converge and all smooth block first-order residuals tend to zero, the limit is stationary. Such conclusions require assumptions on the updates and limiting behavior; a small change in objective is not a stationarity certificate by itself.
ALS may stall in slowly changing regions, settle at a poor stationary fit, or approach a CP boundary with large cancelling components. The earlier border-rank example supplies a concrete reason a vanishing residual need not lead to finite factors. Useful diagnostics include the residual, block gradients, column norms, and sensitivity to starting points. Multiple initializations may improve a practical answer without proving that the best encountered fit is globally optimal.
Work it through
Solve one factor exactly and compare a ridge update
Let a rank-one target have first unfolding [[3, 6, 0, 0], [−1, −2, 0, 0]]. Hold b = (1, 2) and c = (1, 0) fixed. Starting from a = 0, compute the unregularized update and the λ = 5 ridge update.
Our ordering gives z = c ⊗ b = (1, 2, 0, 0), with zᵀz = 5. Multiplication gives T₍₁₎z = (15, −5), so the exact least-squares factor is a = (3, −1), reproducing the target with zero residual.
With λ = 5, divide instead by 5 + 5 = 10. The ridge factor is (3/2, −1/2), half the unregularized factor, and its squared residual is one-quarter of the target squared norm 50, namely 12.5.
The ridge data loss is 6.25 and its penalty is (5/2)((3/2)² + (−1/2)²) = 6.25, totaling 12.5. The old zero factor has objective 25, so the regularized update decreases its own stated objective.
The exact block fit has a = (3, −1); ridge gives (1.5, −0.5) and a lower penalized objective than the old block, while retaining data error.
The living notebook
Explore the model
Interactive lab · optimization
A decreasing local step needs its own stability conditions
For each run Pause and Reset, then set both controls. Choose step size η = 0.5 and initial x₀ = 2; predict positions 1 then 0.5 after one and two Steps, with objectives 0.5 and 0.125. In a fresh run use η = 2.5 and x₀ = 2; one Step gives −3 and objective 4.5, exceeding the starting value 2. This instrument is explicit descent on a scalar quadratic, not exact ALS or a tensor convergence experiment.
- Position x0
- 2
- Objective x²/2
- 2
- Iteration behavior
- Stable step
Gradient descent on f(x) = x²/2: xₙ = (1 − η)ⁿx₀. Playback advances two discrete iterations per second. Values outside |x| ≤ 4 are explicitly reported. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA generic local gradient step does not inherit the monotonicity of an exact block minimization without a suitable step choice.
Pause & reason
Check your understanding
Your turn
Try it yourself
For one scalar factor a, let the fixed design be z = (1, 1) and the target row be x = (2, 0). Compute the unregularized least-squares update and the ridge update with λ = 2, including the penalized objective of the latter.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Use a = (x·z)/(z·z + λ), taking λ = 0 for the unregularized case.
Compare with the solution
The design squared norm is two and the data inner product is two. Without regularization a = 1, giving residual (1, −1) and squared error two. With λ = 2, a = 1/2, giving residual (3/2, −1/2) and squared error 5/2. The ridge data loss is 5/4 and its penalty λa²/2 is 1/4, so the penalized objective is 3/2. The old a = 0 has data loss two and zero penalty. The regularized step therefore lowers its objective while producing larger reconstruction error than the unregularized minimizer, exactly as its changed optimization problem permits.
Keep the idea
Take it with you
- ALS turns one CP factor at a time into an ordinary least-squares block.
- Khatri–Rao ordering and design conditioning directly affect correct and stable updates.
- Monotone objective values do not establish global optimality, bounded factors, or convergence to stable components.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.