Modeladvanced
Factorization machine
Also called FM model.
A regression model whose pairwise feature interactions use dot products of learned factor vectors, computed in time linear in the features.
A factorization machine (FM) is a predictor for real-valued feature vectors that adds to a linear model a weight for every pair of features, and gives that weight as the dot product of two learned vectors, one per feature. Rendle (2010) introduced it to bring the idea of matrix factorization to general feature vectors. Because each feature has its own factor vector, the model can estimate the interaction of two features that never occur together in training, which a model with an independent weight per pair, such as an SVM with a polynomial kernel, cannot do. With one-hot user and item features it is exactly biased matrix factorization, and with other features it gives the SVD++ prediction plus extra terms. The pairwise term looks like it needs work, but an algebraic identity brings it to , and to for a vector with nonzero entries. How well it predicts is measured on data, never proved.
The machine
Model (Rendle 2010, Equations 1 to 3). For a feature vector , a factorization machine of degree 2 predicts
with parameters , and , whose row is the factor vector of feature . The number of factors is a hyperparameter. The prediction is used directly for regression, through its sign or a logistic link for classification, and as a score for ranking (Section III-B); the losses are squared error, hinge, logistic or a pairwise ranking loss, usually with L2 regularization.
Expressiveness (Section III-A2). Every positive semidefinite matrix is for some when is large enough, so with large the model can represent any such matrix of pair weights. The point of a small is the opposite: it forces the pair weights to share structure, which is what lets them be estimated from sparse data.
Input encoding. In the recommender setting a training case is a user, an item and perhaps other context, each written as a block of indicator features. Rendle's Figure 1 uses a block for the user, one for the item, one for the other items the user rated, one for the time, and one for the item rated last.
Degree (Section III-D, Equation 5). The model extends to interactions of up to features, with one factor matrix per order and a weight for given by . The direct cost is , and the paper states that the same argument as for gives linear time.
What it counts
The linear-time identity (Lemma 3.1). For each factor ,
Proof. Expand the square: with . Subtract and halve. Summing over gives the pairwise term of the model.
The right side takes operations per factor, so a prediction costs instead of . Only nonzero contribute to either sum, so the cost is for a sparse vector; for user and item indicators alone, . The identity is exact in real arithmetic; in floating point the subtraction can lose digits when the two terms are large and close.
Gradient (Section III-C, Equation 4). With ,
The sums are already computed for the prediction, so each partial derivative costs and one stochastic gradient step on a case costs . The objective is not convex in , so gradient methods give no guarantee of a global optimum.
Parameters. , linear in , against for independent pair weights.
A small example. Take , , and . The double sum is . With the identity, and , so the term is , the same value.
Relation to other models
- Linear and logistic regression. With the model is linear regression, or logistic regression with a logistic link and log loss.
- Polynomial SVM (Section IV). An SVM with kernel has the same form with an independent weight per pair. With one user and one item indicator per case, a pair in the test set usually has no training case, so its weight stays 0 and the polynomial SVM falls back to user and item biases (Section IV-B). The FM weight is learned from other pairs that share or . Rendle also notes that FMs are trained in the primal and their predictions do not depend on stored support vectors.
- Biased matrix factorization (Section V-A, Equation 12). With the indicators of user and item , the prediction is , which is biased matrix factorization. With more than two categorical variables it is a nested parallel factor analysis (PARAFAC) model.
- SVD++ (Section V-B). Adding the indicators of the set of items the user rated, each scaled by , gives the SVD++ prediction plus extra terms: biases for the items in , their interactions with the user, and interactions between pairs of them.
- PITF and FPMC (Sections V-C and V-D). With user, item and tag indicators and a pairwise ranking loss, the FM is the PITF tag model except for a tag bias and shared tag factors. With the user's previous basket as features it is close to factorized personalized Markov chains for next-basket prediction, a sequential model related to session-based recommendation.
- Ranking. For ranking, the paper trains on pairs of cases with a pairwise classification loss (Section III-B). The pairwise loss of Bayesian personalized ranking is one such loss, and the PITF comparison uses pairwise ranking.
- Side information. Because user and item attributes are just more features, an FM can score users or items with few interactions from their attributes, which is one approach to the cold-start problem and a form of hybrid recommender.
- Later variants. Field-aware factorization machines give each feature one factor vector per field of the other feature. Models such as DeepFM combine an FM with a neural network. Higher-order FMs use the degree- form.
Known results in the model
These are measurements reported in the paper, not theorems.
- Netflix (Figure 2). On the Netflix rating data with user and item indicators, the paper plots test RMSE against for FMs and SVMs and reports that FMs estimate the pairwise interactions where SVMs fail.
- Tag recommendation (Figure 3). On Task 2 of the ECML/PKDD Discovery Challenge 2009, an FM reached a quality (F1 at top 5) comparable to the winning PITF model at the same number of parameters.
The linear-time identity and the special cases above are exact algebra. Whether the factorized pair weights help on a given data set is measured, not proved.
References
- Steffen Rendle, Factorization machines, Proceedings of the 10th IEEE International Conference on Data Mining (ICDM 2010), Section III-A (Equations 1 to 3, the model; Lemma 3.1, the O(k n) form), Section III-C (Equation 4, the gradient), Section III-D (Equation 5, the d-way model), Section IV (comparison with polynomial SVMs under sparsity, Figure 2), Section V (matrix factorization, SVD++, PITF and FPMC as special cases, Figure 3)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W3 standard |
|
Tag WQQ5T1 Edit this page History Report an error Markdown