This project focuses on improving Click-Through Rate (CTR) prediction in sparse and privacy-constrained environments, where traditional user tracking methods such as cookies are limited.
Conventional recommendation systems rely heavily on user interaction history, which leads to performance degradation in cold-start and sparse data scenarios.
To address this problem, we propose an intent-aware recommendation framework that combines:
- Aggregated user behavior features
- Semantic user intent embeddings generated from behavior summaries
- DeepFM-based CTR prediction model
The goal is to enhance recommendation performance by incorporating user intent, especially when behavioral data is limited.
The overall pipeline consists of the following steps:
-
Behavior Aggregation
User interaction logs are aggregated to create features such as:- total views, cart, purchases
- buy rate, cart rate
- category distribution and activity level
-
Ad Embedding
Ad features are converted into text descriptions and encoded using a Sentence Transformer.
The embeddings are then reduced using PCA. -
Intent Feature Engineering
User behavior is transformed into high-level funnel features and converted into natural language templates describing user intent. -
Intent Embedding
The generated intent text is encoded into dense vectors using a Sentence Transformer. -
Data Preparation
All features (user, ad, behavior) are merged and normalized.
The dataset is split into training and test sets based on timestamp. -
Model Training
- Model A: DeepFM using structured features only
- Model B: DeepFM with additional intent and ad embeddings
-
Evaluation
Performance is evaluated using:- AUC
- Log Loss
- ECE (Expected Calibration Error)
## Dataset Setup
This project uses the **Taobao Ad Click Dataset**.
Download the dataset from:
https://www.kaggle.com/datasets/pavansanagapati/ad-displayclick-data-on-taobaocom
After downloading, place the following files inside the `data/` directory:
- raw_sample.csv
- user_profile.csv
- ad_feature.csv
- behavior_log.csv
Example structure:
data/
├── raw_sample.csv
├── user_profile.csv
├── ad_feature.csv
└── behavior_log.csv
⚠️ Note:
- The dataset is not included in this repository due to size limitations.
- Make sure file names match exactly, or the pipeline will fail.
- BST (Behavior Sequence Transformer)
- Uses sequential user behavior data
- Implemented using FuxiCTR
- Provides upper-bound performance benchmark
[Sparse & Dense Features]
│
▼
[Embedding Layer]
(Sparse → Dense Vector)
│
├───────────────┐
▼ ▼
[FM Component] [Deep Component]
(2nd-order (MLP)
interactions) nonlinear learning
│ │
└──────┬────────┘
▼
[Output Layer]
CTR Prediction
- AUC: 0.6424
- LogLoss: 0.1943
- ECE: 0.0122
### Model B (Enhanced: Intent-aware DeepFM)
[User Behavior Data]
│
▼
[Feature Engineering]
(pv_to_cart, buy_rate, etc.)
│
▼
[Text Template]
"User is a high conversion buyer..."
│
▼
[Sentence Transformer]
│
▼
[PCA]
(Intent Embedding)
│
▼
────────────────────────────────
[Structured Features + Intent Embedding]
│
▼
[Embedding Layer]
│
├───────────────┐
▼ ▼
[FM Component] [Deep Component]
│ │
└──────┬────────┘
▼
[Output Layer]
CTR Prediction
Model B (Enhanced)
- AUC: 0.6592
- LogLoss: 0.1925
- ECE: 0.0076
Key observations:
- Model B outperforms Model A in overall performance
- Improvement is especially significant for sparse users
- Intent embeddings help recover performance loss in limited data settings
ctr_project/
- data/ (dataset not included)
- output/ (generated results, ignored)
- scripts/
- run_model_a.py (baseline model execution)
- run_model_b.py (intent-enhanced model execution)
- run_model_c.py (placeholder for upper-bound model)
- src/
- config.py (configuration settings)
- pipeline.py (data processing pipeline)
- dataset.py (PyTorch dataset)
- models.py (DeepFM model)
- train_eval.py (training and evaluation logic)
- requirements.txt
- README.md
- Guo et al. (2017), DeepFM: A Factorization-Machine based Neural Network for CTR Prediction
- Chen et al. (2019), Behavior Sequence Transformer (BST)
- Reimers & Gurevych (2019), Sentence-BERT
- Taobao Ad Click Dataset (Alibaba)