Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ModelZoo] Support Co_Action Network #344

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions modelzoo/CAN/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Co-Action Network

The following is a brief directory structure and description for this example:



```
├── data # Data set directory
│ ├── prepare_data.sh # Shell script to download and process dataset
│ └── README.md # Documentation describing how to prepare dataset
│ └── script # Directory contains scripts to process dataset
│ ├── data_iterator.py
│ ├── generate_voc.py # Create a list of features
│ ├── local_aggretor.py # Generate sample data
│ ├── shuffle.py
│ ├──process_data.py # Parse raw json data
│ └── split_by_user.py # Divide the dataset
├── script # Directory contains scripts to CAN model
│ ├── Dice.py
│ ├── model.py
│ ├── model_avazu.py
│ ├── rnn.py
│ └── utils.py
├── README.md # Documentation
└── train.py # Training script
```



## Content

[TOC]



## Model Structure

Implementation of paper "CAN: Revisiting Feature Co-Action for Click Through Rate Prediction".

paper: [arxiv (to be released)]()



## Usage

### Stand-alone Training

1. Please prepare the data set and DeepRec env.

1. Manually

- Follow [dataset preparation](https://github.com/alibaba/DeepRec/tree/main/modelzoo/DIEN#prepare) to prepare data set.
- Download code by `git clone https://github.com/alibaba/DeepRec`
- Follow [How to Build](https://github.com/alibaba/DeepRec#how-to-build) to build DeepRec whl package and install by `pip install $DEEPREC_WHL`.

2. Docker(Recommended)

```
docker pull alideeprec/deeprec-release-modelzoo:latest
docker run -it alideeprec/deeprec-release-modelzoo:latest /bin/bash

# In docker container
cd /root/modelzoo/CAN
```

​ 2.train.

```
python train.py
```




## Dataset

Amazon Dataset Books dataset is used as benchmark dataset.

### Prepare

For details of Data download, see `./data`



14 changes: 14 additions & 0 deletions modelzoo/CAN/data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Dataset

## Prepare dataset

Prepare data of DIEN first;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CAN


Run `prepare_data.sh` to download and process data:

```
sh prepare_data.sh
```

Put data into this folder.

10 changes: 10 additions & 0 deletions modelzoo/CAN/data/prepare_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export PATH="~/anaconda4/bin:$PATH"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移除本地开发变量

wget http://snap.stanford.edu/data/amazon/productGraph/categoryFiles/reviews_Books.json.gz
wget http://snap.stanford.edu/data/amazon/productGraph/categoryFiles/meta_Books.json.gz
gunzip reviews_Books.json.gz
gunzip meta_Books.json.gz
python script/process_data.py meta_Books.json reviews_Books.json
python script/local_aggretor.py
python script/split_by_user.py
python script/generate_voc.py

Loading