Summary
Suppose training contains feature pairs A-B and B-C, but not A-C. A factorization machine assigns a shared vector to each feature, making the A-C dot product computable. That supplies an estimate, not evidence that the estimate is accurate.
For features, give feature a scalar weight and vector . With global bias , the prediction score is
An independent degree-two model stores pair coefficients; FM stores interaction parameters plus main effects. This changes statistical sharing as well as storage when . An absent pair’s independent coefficient lacks direct co-occurrence evidence; shared vectors impose an additional modeling assumption. The following vectors are chosen fixtures, not fitted outputs.
Parameter sharing
Reuse feature vectors for active pairs; computable interactions are not observed or validated ones
Reference drawing
Parameter sharing
Reuse feature vectors for active pairs; computable interactions are not observed or validated ones
Derivation
| Explicit AB + AC + BC | 0.80 + 0.60 + 0.56 = 1.96 |
|---|---|
| Squared norm of summed vectors | 2.4² + 0.6² = 6.12 |
| Sum of individual squared norms | 1 + 0.68 + 0.52 = 2.20 |
| Half the difference | (6.12 − 2.20) / 2 = 1.96 |
The mechanism
For each coordinate , expanding gives diagonal terms plus twice every pair. Subtract those self-terms, divide by two, and sum over coordinates:
For active inputs, this costs instead of enumerating vector pairs. Parameter storage still depends on the full feature vocabulary, .
Using the illustrated vectors and , pair coefficients are , summing to . The vector sum is ; half of also gives . Deactivating B leaves only A-C and score , with bias and linear terms zero.
Sparse one-hot inputs
Categorical IDs can be one-hot encoded; numeric inputs can also participate with their actual values. A pair contributes only when both input values are nonzero.
Change active inputs
New task: activate only one user indicator and one item indicator, both equal to one.
Picture and change: remove every inactive linear and interaction term:
Check: fitted values and vectors give . This is biased matrix factorization’s score, not an automatically bounded rating or probability. Adding category, time, or device features introduces their linear terms and active pairs, not explicit third-order terms.
Use when: compare FM with MF on matched features.
Change field specificity
New task: let a category feature interact differently with user and time fields.
Picture and change: field-aware FM uses for feature fields . In a separate one-dimensional fixture, category A uses value one against users and two against time. The counterpart vectors are three and four, respectively.
Check: category-user interaction is ; category-time is . Reusing A’s value one for both would give four for the latter pair. The plain-FM aggregate-square computation cannot simply reuse one vector per feature here.
Use when: measured field-specific benefits justify added storage and compute.
Variants
- Field-aware FM has field-indexed feature vectors, increasing storage to roughly for fields.
- DeepFM combines an FM component with a deep branch sharing feature embeddings.
- xDeepFM uses a compressed interaction network; AutoInt uses attention; DCN uses cross layers. Their interaction computations differ.
Tradeoffs
FM shares pair coefficients instead of fitting them independently, trading flexibility for statistical reuse. Compare logistic regression, boosting, and interaction models with matched features and task metrics. Architectural complexity does not guarantee better accuracy, speed, or interpretation. Choose the loss/link separately: binary outcomes might use a sigmoid and logistic loss on the score.
Common pitfalls
Keep main effects: with one active feature, there is no pair term. Numeric-feature scaling changes interaction magnitudes; normalize or otherwise validate preprocessing rather than requiring arbitrary binning. Tune and regularization, especially for rare features. A new untrained feature needs an unknown-feature/initialization policy; an available unseen-pair coefficient does not solve unseen-feature support. Removing Gram diagonal terms does not imply the remaining off-diagonal matrix itself has rank .
Does plain FM explicitly model arbitrary third-order interactions?
Answer
No. Its explicit interaction polynomial has degree two; higher-order behavior requires another computation.
Original formulation: Rendle (2010).