recbole.AFM
A factorization machine that uses an attention network to weight each pairwise feature interaction.
Tabular and recommender · 37 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Parameters
- 995.2K
- Operations
- 37
- Framework
- PyTorch
- Recurrent
- No
- Published
- IJCAI 2017
- Cited by
- 943 (as of 22 October 2026)
- Authors
- Jun Xiao, Hao Ye, Xiangnan He and others
- Source
- recbole 1.2.1
- License
- MIT
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m8586
- Graph hash
- bd07c216e08498158d7ecaddbdc9166bc40a4dcc390d008de6ab73d1511f0655
- Skeleton hash
- 983735f9a531b011ca3ad480db6b7641f2e673fb46bb81f9a667322d792a9817
- Architecture hash
- b900d700d49f4e49903d644a2e36d03b70aecc9ae61d6ed742976414cac1b10e
- Diagram SHA-256
- f3e2c53c7aa4546e79e05c92271ad56b2c8c0474b16de96276bc52f6261207f8
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
AFM, the Attentional Factorization Machine, is a factorization machine (FM) that learns how much each feature interaction should count. An FM is a supervised learning approach that enhances the linear regression model by incorporating second-order feature interactions. The paper's concern is that FM models all feature interactions with the same weight, although not all of them are equally useful and predictive, and interactions with useless features may even introduce noise. AFM instead learns the importance of each feature interaction from data via a neural attention network.
On two real-world datasets, the paper reports that AFM improves on FM by a relative 8.6% on a regression task, and that it outperforms the deep learning methods Wide&Deep and DeepCross with a much simpler structure and fewer model parameters. The authors' own code trains AFM starting from the pretrained weights of FM. Its example dataset is MovieLens tag data, where each tag application (user ID, movie ID and tag) is converted to a one-hot feature vector, giving 90,445 binary features.
Key idea. The paper improves the factorization machine by learning the importance of each feature interaction from data with a neural attention network.
- AFM
- Attentional Factorization Machine
- attentional factorization machines
- factorization machine
- feature interactions
- attention network
- context-aware recommendation
- sparse feature prediction
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{xiao2017attentionalfactorizationmachineslearning,
title={Attentional Factorization Machines: Learning the Weight of Feature Interactions via Attention Networks},
author={Jun Xiao and Hao Ye and Xiangnan He and Hanwang Zhang and Fei Wu and Tat-Seng Chua},
year={2017},
eprint={1708.04617},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1708.04617},
}