본 글은 2017년 발표된 DeepFM: A Factorization-Machine based Neural Network for CTR Prediction을 읽고 요약 및 정리한 글입니다.
논문
직접 구현 DeepFM 모델 코드 (Pytorch)
직접 구현 DeepFM Movielens100k 학습 코드 (Jupyter)
| 항목 | Wide & Deep | DeepFM |
|---|---|---|
| 구성 | Wide (Linear model) + Deep(MLP) | FM (low-order interactions) + Deep(high-order interactions) |
| Feature Engineering | 수동 Feature Cross 필요 | 자동 Feature Factorization Machines 학습 |
| Embedding 공유 | ❌ (Wide와 Deep 입력 분리) | ✅ (FM과 Deep이 Embedding Layer 공유) |
| Interaction Modeling | - Wide: 1차, 수동 조합 - Deep: 고차 비선형 | - FM: 2차 상호작용 - Deep: 고차 비선형 |
| 모델 수식 |
| 구분 | FM Component | Deep Component |
|---|---|---|
| 역할 | Low-order feature interaction | High-order feature interaction |
| 목적 | 2차 상호작용(Feature pair) 자동 학습 | 복잡한 비선형 관계 학습 |
| 특징 | - Pairwise interaction 자동 학습 - Linear model 기반 | - 비선형 관계 학습 - MLP: Deep representation |
| 모델 수식 | ① 1차 항: ② 2차 항: | |

- Normal Connection
- Red arrow: weight1의 연결
- Blue arrow: Embedding
- Addion: 모든 input을 함께 더함
- Wide 와 Deep Component는 동일한 raw feature vector를 공유
- low- & high-order feature interactions를 함께 학습

- : order-1 importance
- : 다른 피처와의 interactions 효과를 측정하는데 사용
- FM component의 input으로 사용되어 order-2 feature interaction
- Deep component의 input으로 사용되어 high-rder feagture interaction

Factorization Machine
- (order-1) Addition unit
- (order-2) Pairwise feature interation
- 각각의 feature latent vector를 inner product
- 전혀 등장하지 않거나 거의 등장하지 않은 학습 데이터에 대해서도 학습 가능

DNN

| No Pre-training | High-order Features | Low-order Features | No Feature Engineering | |
|---|---|---|---|---|
| FNN | × | √ | × | √ |
| PNN | √ | √ | × | √ |
| Wide & Deep | √ | √ | √ | × |
| DeepFM | √ | √ | √ | √ |
Efficiency

Effectiveness
