Skip to content

zhouxy1003/TIN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Temporal Interest Network for User Response Prediction

The open source code for WWW 2024 paper "Temporal Interest Network for User Response Prediction".

Model overview

TIN architecture

TIN architecture

Temporal Interest Module

Temporal Interest Module

Getting started

Requirements

  • Python >= 2.6.1
  • NumPy >= 1.12.1
  • Pandas >= 0.20.1
  • TensorFlow >= 1.4.0
  • GPU with memory >= 10G

Download dataset and preprocess

One can refer to the official code of DIN to learn about the pre-processing of the Amazon product dataset in detail in the Download dataset and preprocess section.

  • Step 1: Download the Amazon product dataset of Electronics category, which has 498,196 products and 7,824,482 records, and extract it to raw_data/ folder.

    mkdir raw_data/
    cd data
    bash 0_download_raw.sh
  • Step 2: Convert raw data to pandas dataframe, and remap categorical id.

    python 1_convert_pd.py
    python 2_remap_id.py
  • Step 3: Build the amazon product dataset.

    python build_dataset.py

Note that the key difference is that in our code, we split the dataset into training, validation, and test set, while in the original code of DIN, the authors only use training and test set. Such an approach may introduce cherry-pick problems, the performance of the model may be overestimated. Specifically, we save the model with the best performance on the validation set (GAUC), and use the prediction result of the saved model on the test set as the evaluation criterion for the current model.

Training and evaluation

This implementation contains the method TIN and all the other competitors, including DIN, DIEN, DSIN, BST, GRU4Rec, SASRec, Bert4Rec, etc. The training procedures of all method is as follows:

  • Step 1: Choose a method and enter the model folder (Take TIN as an example).

    cd model/tin
  • Step 2: Modify the dataset path and train a TIN model by running the following script.

    python train_tin.py

Measurement of semantic-temporal correlation

Visualize the Category-wise Target-aware Correlation (CTC)

  • Step 1: Preprocess the dataset and save the statistics for computing the Category-wise Target-aware Correlation.
    cd visualization
    python amazon_pre_pos.py
  • Step 2: Compute and plot the Category-wise Target-aware Correlation.
    python amazon_mul_c_pos.py
Category-wise Target-aware Correlation

Visualize the learned semantic-temporal correlation

  • Step 1: Save the value of position embedding and category embedding of different models after training as p.npy and c.npy.
  • Step 2: Compute the learned quadruple correlation.
    python temporal_correlation.py
Learned semantic-temporal correlation of TIN

Concat

If you have any question about this implementation, please create an issue or send us an Email at:

If you have any question about the model and the paper, feel free to contact:

Citation

If you find our code or propcessed data helpful in your research, please kindly cite the following papers.

@article{zhou2023temporal,
  title={Temporal interest network for user response prediction},
  author={Zhou, Haolin and Pan, Junwei and Zhou, Xinyi and Chen, Xihua and Jiang, Jie and Gao, Xiaofeng and Chen, Guihai},
  booktitle={Proceedings of the 2024 World Wide Web Conference},
  year={2024}
}

About

Code for paper "Temporal Interest Network for Click-Through Rate Prediction"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published