The interview problem

Practice prompt

Factor a nonnegative count matrix into additive components and explain why the factors are not uniquely determined.

Original practice, not a reported company interview. Scenarios and numbers are illustrative. Interview date: not applicable. Sources retrieved October 1, 2026.

1. Scope and worked approach

Assume nonnegative observations and choose rank k with a reconstruction loss suited to the data. Fit X approximately WH with both factors nonnegative, checking held-out reconstruction and stability across initializations. Components add rather than cancel, which can help interpretation. Normalize factors by a documented convention before comparing runs; this does not remove all ambiguities.

2. Trace the design or derivation

Choose rank and loss
  → initialize factors
  → optimize
  → normalize
  → inspect stability

For count data, distinguish zeros meaning observed absence from missing entries that were never measured. Treating missing entries as zero biases the factorization. If factors are used downstream, fit them on training data and transform held-out records without refitting across the evaluation boundary.

3. Calculate the example

For W=[[1],[2]] and H=[[3,4]], WH=[[3,4],[6,8]]. Replacing W by 2W and H by H/2 gives the same reconstruction. Therefore factor magnitudes alone cannot be interpreted without a scale convention.

4. Failure cases and trade-offs

Local optima and excessive rank can create unstable components. Nonnegative components are not automatically real-world causes. More components improve reconstruction but can fragment meaning; fewer are easier to inspect but may merge distinct patterns. Compare with a simpler baseline and audit representative examples for each component.

5. Validation, follow-ups and self-review

Verify reconstruction, nonnegativity and scale invariance on the example. Follow-up: when would a count-based divergence fit better than squared error? Self-review: distinguish additive interpretation, rank selection and causal claims.

Sources and related practice

Technical reference: scikit-learn.org — Matrix decomposition, ICA, nonnegative factors and topic representations; examples and analyst workflows are original.

Source publication/update: Not established. Retrieved October 1, 2026. The workflow, calculations and review exercises are original; this reference is not evidence that a company asked this question.

Continue with Choose a low-rank approximation using singular values; Discover and name emerging support themes.

Continue your preparation

Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.