Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
4e509e7
Create README.md
weiwei1206 Jan 4, 2022
a13b159
Create README.md
weiwei1206 Jan 4, 2022
68a56fa
Update README.md
weiwei1206 Jan 4, 2022
2e499be
Update README.md
weiwei1206 Jan 4, 2022
cffcb2c
Update README.md
weiwei1206 Jan 4, 2022
29f983d
Update README.md
weiwei1206 Jan 4, 2022
b18727f
Update README.md
weiwei1206 Jan 4, 2022
4ad4238
Update README.md
weiwei1206 Jan 4, 2022
57e3559
Update README.md
weiwei1206 Jan 4, 2022
db1da52
Update README.md
weiwei1206 Jan 20, 2022
5b32d94
Update README.md
weiwei1206 Mar 31, 2022
6360743
Update main.py
weiwei1206 May 8, 2022
b86adcf
Update README.md
weiwei1206 May 11, 2022
b8e6af4
Create README.md
weiwei1206 May 11, 2022
86724ec
Update README.md
weiwei1206 May 11, 2022
9a0d211
Create README.md
weiwei1206 May 11, 2022
9b6c5cc
Create README.md
weiwei1206 May 29, 2022
2685dd6
Create README.md
weiwei1206 May 29, 2022
1b586a3
Create README.md
weiwei1206 May 29, 2022
92c9540
upload datasets IJCAI_15
weiwei1206 Jun 1, 2022
c3deec5
upload datasets Tmall
weiwei1206 Jun 1, 2022
97c52a7
Delete README.md
weiwei1206 Jun 1, 2022
ec7329b
Delete README.md
weiwei1206 Jun 1, 2022
a702887
Delete README.md
weiwei1206 Jun 1, 2022
f679971
Update README.md
weiwei1206 Jun 1, 2022
e49c10b
Update README.md
weiwei1206 Jun 1, 2022
a74d9b2
Update README.md
weiwei1206 Jun 1, 2022
e6dd0fb
Update README.md
weiwei1206 Jun 1, 2022
d36ce82
Update README.md
weiwei1206 Jun 1, 2022
c7cab10
Fix dataset path not found BUG
stellarkey Jul 22, 2022
57684b1
Update Params.py
weiwei1206 Oct 25, 2022
06f05c8
Update README.md
weiwei1206 Oct 28, 2022
4b6326b
Update main.py
weiwei1206 Oct 28, 2022
f186fe9
Update Params.py
weiwei1206 Oct 28, 2022
e0c2b8d
Delete BGNN.py
weiwei1206 Oct 28, 2022
56a9580
Delete main.py
weiwei1206 Oct 28, 2022
d5f9758
Delete graph_utils.py
weiwei1206 Oct 28, 2022
79deae5
Delete Params.py
weiwei1206 Oct 28, 2022
ff35ee2
Delete MV_Net.py
weiwei1206 Oct 28, 2022
fb54430
Delete DataHandler.py
weiwei1206 Oct 28, 2022
f91a529
Delete datasets directory
weiwei1206 Oct 28, 2022
e1fb0df
Delete __pycache__ directory
weiwei1206 Oct 28, 2022
99a4f30
Delete Utils directory
weiwei1206 Oct 28, 2022
ac7e833
Update README.md
weiwei1206 Oct 28, 2022
1d51e6f
Update README.md
weiwei1206 Oct 28, 2022
eb8f167
Update README.md
weiwei1206 Oct 31, 2022
69f6161
Create README.md
weiwei1206 Nov 8, 2022
de99684
Add files via upload
weiwei1206 Nov 8, 2022
2d43d0d
Add files via upload
weiwei1206 Nov 8, 2022
ca1c86a
Create README.md
weiwei1206 Nov 8, 2022
94a3155
Add files via upload
weiwei1206 Nov 8, 2022
c25c688
Delete JD.zip
weiwei1206 Nov 8, 2022
7b579f5
Add files via upload
weiwei1206 Nov 8, 2022
87739d6
Update Params.py
weiwei1206 Nov 8, 2022
f2f9146
Update README.md
weiwei1206 Nov 8, 2022
dd3469b
Update README.md
Nov 6, 2023
2f4be9f
Merge pull request #1 from stellarkey/main
weiwei1206 Nov 6, 2023
dd84acd
Delete data/IJCAI_15.zip
weiwei1206 Oct 28, 2024
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
313 changes: 69 additions & 244 deletions Params.py

Large diffs are not rendered by default.

88 changes: 76 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,90 @@
# CML
The implementation of Contrastive Meta Learning with Behavior Multiplicity for Recommendation

mkdir /History

mkdir /Model
This repository contains PyTorch codes and datasets for the paper:

### Requirements
numpy==1.20.3
> Wei, Wei and Huang, Chao and Xia, Lianghao and Xu, Yong and Zhao, Jiashu and Yin, Dawei. Contrastive Meta Learning with Behavior Multiplicity forRecommendation. <a href='https://arxiv.org/pdf/2202.08523.pdf'>Paper in arXiv</a>.

scipy==1.6.2

torch==1.8.1+cu111
## Introduction
Contrastive Meta Learning (CML) leverages multi-behavior learning paradigm to model diverse and multiplex user-item relationships, as well as tackling the label scarcity problem for target behaviors. The designed multi-behavior contrastive task is to capture the transferable user-item relationships from multi-typed user behavior data heterogeneity. And the proposed meta contrastive encoding scheme allows CML to preserve the personalized multi-behavior characteristics, so as to be reflective of the diverse behavior-aware user preference under a customized self-supervised framework.

tqdm==4.61.2

## Citation
```
@inproceedings{wei2022contrastive,
title={Contrastive meta learning with behavior multiplicity for recommendation},
author={Wei, Wei and Huang, Chao and Xia, Lianghao and Xu, Yong and Zhao, Jiashu and Yin, Dawei},
booktitle={Proceedings of the Fifteenth ACM International Conference on Web Search and Data Mining},
pages={1120--1128},
year={2022}
}
```


## Environment

The codes of CML are implemented and tested under the following development environment:

- Python 3.6
- torch==1.8.1+cu111
- scipy==1.6.2
- tqdm==4.61.2



## Datasets

#### Raw data:
- IJCAI contest: https://tianchi.aliyun.com/dataset/dataDetail?dataId=47
- Retail Rocket: https://www.kaggle.com/retailrocket/ecommerce-dataset
- Tmall: https://tianchi.aliyun.com/dataset/dataDetail?dataId=649
#### Processed data:
- The processed IJCAI are under the /datasets folder.


## Usage

The command to train CML on the Tmall/IJCAI/Retailrocket datasets are as follows. The commands specify the hyperparameter settings that generate the reported results in the paper.

* Tmall
```
python main.py --path=./datasets/ --dataset=Tmall --opt_base_lr=1e-3 --opt_max_lr=5e-3 --opt_weight_decay=1e-4 --meta_opt_base_lr=1e-4 --meta_opt_max_lr=2e-3 --meta_opt_weight_decay=1e-4 --meta_lr=1e-3 --batch=8192 --meta_batch=128 --SSL_batch=18
```
* IJCAI
```
python main.py --path=./datasets/ --dataset=IJCAI_15 --sampNum=10 --opt_base_lr=1e-3 --opt_max_lr=2e-3 --opt_weight_decay=1e-4 --meta_opt_base_lr=1e-4 --meta_opt_max_lr=1e-3 --meta_opt_weight_decay=1e-4 --meta_lr=1e-3 --batch=8192 --meta_batch=128 --SSL_batch=30
```
* Retailrocket
```
python main.py --path=./datasets/ --dataset='retailrocket' --sampNum=40 --lr=3e-4 --opt_base_lr=1e-4 --opt_max_lr=1e-3 --opt_weight_decay=1e-4 --opt_weight_decay=1e-4 --meta_opt_base_lr=1e-4 --meta_opt_max_lr=1e-3 --meta_opt_weight_decay=1e-3 --meta_lr=1e-3 --batch=2048 --meta_batch=128 --SSL_batch=15
```



<!-- Important arguments:
* `reg`: It is the weight for weight-decay regularization. We tune this hyperparameter from the set `{1e-2, 1e-3, 1e-4, 1e-5}`.
* `ssl_reg`: This is the weight for the hypergraph-graph contrastive learning loss. The value is tuned from `1e-2` to `1e-8`.
* `temp`: This is the temperature factor in the InfoNCE loss in our contrastive learning. The value is selected from `{10, 3, 1, 0.3, 0.1}`.
* `keepRate`: It denotes the rate to keep edges in the graph dropout, which is tuned from `{0.25, 0.5, 0.75, 1.0}`.
-->





<!-- ## Acknowledgement
-->





It will be released again in few days in the optimized code version.

### Datasets
IJCAI contest: https://tianchi.aliyun.com/dataset/dataDetail?dataId=47

Retail Rocket: https://www.kaggle.com/retailrocket/ecommerce-dataset

Tmall: https://tianchi.aliyun.com/dataset/dataDetail?dataId=649



Expand Down
1 change: 1 addition & 0 deletions Utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.
Binary file removed __pycache__/BGNN.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/BSTRec.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/BSTRec_beh.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/DataHandler.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/DataHandler.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/MB_GCN.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/MB_GCN_test.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/MB_GCN_test_behavior.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed __pycache__/MV_Net.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/MV_Net_beh.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/MV_Net_one_weights.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/NMTR.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/Params.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/Params.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/cell.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file removed __pycache__/evaluate.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/evaluate.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/graph_utils.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/graph_utils_gcn.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/graph_utils_time.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/hypergraph_utils.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/hypergraph_utils.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/meta_weight_net.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/meta_weight_net_single.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/meta_weight_net_trans.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/myModel.cpython-37.pyc
Binary file not shown.
Binary file removed __pycache__/myModel.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/myModel_NoGNN.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/myModel_NoGNN_mean.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/myModel_NoGNN_tmall.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/myModel_RNN.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/myModel_mean.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/myModel_mean_tmall.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/myModel_meta_RNN.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/myModel_meta_RNN_GAT.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/myModel_meta_RNN_GCN.cpython-38.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed __pycache__/myModel_multi_head.cpython-38.pyc
Binary file not shown.
Binary file removed __pycache__/myModel_ori.cpython-38.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ def trainEpoch(self):
time = datetime.datetime.now()
print("start_ng_samp: ", time)
train_loader.dataset.ng_sample()
time = datetime.datetime.now()


print("end_ng_samp: ", time)

epoch_loss = 0
Expand Down