Skip to content

Code for the content caching algorithm in edge caching.

License

Notifications You must be signed in to change notification settings

DarriusL/CoCheLab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoCheLab

Code for the Content Caching algorithm in edge caching.

Environment configuration

git clone https://github.com/DarriusL/CacheLab.git

Create an environment using one of these methods:

conda

cd CacheLab
conda env create -f cachelab_dev.yml
conda activate cachelab_dev

pip

conda create -n CacheLab python=3.11
pip install -r requirements.txt

Framework file structure

├── .gitignore
├── cache
├── cachelab_env.yml
├── config
│	├── caser
│	│	├── caser_appliances.json
│	│	├── caser_ml1m.json
│	│	└── caser_music.json
│	├── CFG_README.md
│	├── cl4srec
│	│	├── cl4srec_appliances.json
│	│	├── cl4srec_ml1m.json
│	│	└── cl4srec_music.json
│	├── data_process_cfg.json
│	├── duo4srec
│	│	├── duo4srec_appliances.json
│	│	├── duo4srec_ml1m.json
│	│	└── duo4srec_music.json
│	├── ec4srec
│	│	├── ec4srec_appliances.json
│	│	├── ec4srec_ml1m.json
│	│	└── ec4srec_music.json
│	├── egpc
│	│	├── egpc_appliances.json
│	│	├── egpc_ml1m.json
│	│	└── egpc_music.json
│	├── fifo
│	│	├── fifo_appliances.json
│	│	├── fifo_ml1m.json
│	│	└── fifo_music.json
│	├── lab_cfg.json
│	├── lfu
│	│	├── lfu_appliances.json
│	│	├── lfu_ml1m.json
│	│	└── lfu_music.json
│	├── lru
│	│	├── lru_appliances.json
│	│	├── lru_ml1m.json
│	│	└── lru_music.json
│	└── psac
│		├── psac_gen_appliances.json
│		├── psac_gen_ml1m.json
│		└── psac_gen_music.json
├── data
│	├── augmentation.py
│	├── datasets
│	│	├── meta
│	│	│	├── appliances
│	│	│	│	├── Appliances.json
│	│	│	│	└── Appliances_lite.json
│	│	│	├── beauty
│	│	│	│	├── All_Beauty.json
│	│	│	│	└── All_Beauty_lite.json
│	│	│	├── kindle
│	│	│	│	├── Kindle_Store.json
│	│	│	│	└── Kindle_Store_lite.json
│	│	│	├── ml-1m
│	│	│	│	├── movies.dat
│	│	│	│	├── ratings.dat
│	│	│	│	├── README
│	│	│	│	└── users.dat
│	│	│	└── music
│	│	│		├── Digital_Music.json
│	│	│		└── Digital_Music_lite.json
│	│	└── process
│	│		├── complete
│	│		│	├── All_Beauty.data
│	│		│	├── Appliances.data
│	│		│	├── appliances_devide_25.data
│	│		│	├── Digital_Music.data
│	│		│	├── kindle_devide_25.data
│	│		│	├── Kindle_Store.data
│	│		│	├── ml.data
│	│		│	├── ml_devide_55.data
│	│		│	└── music_devide_25.data
│	│		└── lite
│	│			├── All_Beauty_lite.data
│	│			├── Appliances_lite.data
│	│			├── Digital_Music_lite.data
│	│			├── Kindle_Store_lite.data
│	│			├── ml.data
│	│			└── music_devide_25.data
│	├── generator.py
│	├── processor.py
│	├── saved./
│	└── __init__.py
├── executor.py
├── lib
│	├── callback.py
│	├── glb_var.py
│	├── json_util.py
│	└── util.py
├── LICENSE
├── model
│	├── attnet.py
│	├── cnnnet.py
│	├── framework
│	│	├── base.py
│	│	├── caser.py
│	│	├── cl4srec.py
│	│	├── duo4srec.py
│	│	├── ec4srec.py
│	│	├── egpc.py
│	│	├── fifo.py
│	│	├── lfu.py
│	│	├── lru.py
│	│	└── psac.py
│	├── loss.py
│	└── __init__.py
├── README.md
├── requirements.txt
└── Room
	├── officer.py
	├── work.py
	└── __init__.py

Dataset acquisition:


ML-1M

Amazon review lite

Amazon review

The original dataset is downloaded and saved in the path: ./data/datasets/meta/

At the same time, I also provide the google drive link to the original data set and the processed data set.

If you need to use the provided processed data set, download it to path : ./data/dataset/process/

Algorithms that have been implemented and algorithms that will be supported soon:


Coventional:

  • FIFO
  • LRU
  • LFU

CL-based:

  • CL4SRec[1]
  • Duo4SRec(DuoSRec)[2]
  • EC4SRec[3]
  • EGPC

DL-based:

Configuration file related: CFG_README.md

Command

usage

usage: executor.py [-h] [--data_process DATA_PROCESS] [--config CONFIG] [--saved_config SAVED_CONFIG] [--mode MODE]

options

-h, --help            show this help message and exit
--data_process DATA_PROCESS, -dp DATA_PROCESS
                    type for data process(None/lite/complete)
--config CONFIG, -cfg CONFIG
                    config for run
--saved_config SAVED_CONFIG, -sc SAVED_CONFIG
                    path for saved config to test
--mode MODE           train/test/train_and_test

For configuration files, see:./config/CFG_README.md

quick start

process dataset

You need to configure the data processing configuration file yourself:@./config/data_process_cfg.json

If you use original data, please use the command for data processing. Or you can download the processed data, then just skip it.

python executor.py --data_process=True

FIFO

python executor.py -sc='./config/fifo/fifo_ml1m.json' --mode=test
python executor.py -sc='./config/fifo/fifo_appliances.json' --mode=test
python executor.py -sc='./config/fifo/fifo_music.json' --mode=test

LRU

python executor.py -sc='./config/lru/lru_ml1m.json' --mode=test
python executor.py -sc='./config/lru/lru_appliances.json' --mode=test
python executor.py -sc='./config/lru/lru_music.json' --mode=test

LFU

python executor.py -sc='./config/lfu/lfu_ml1m.json' --mode=test
python executor.py -sc='./config/lfu/lfu_appliances.json' --mode=test
python executor.py -sc='./config/lfu/lfu_music.json' --mode=test

CL4SRec

python executor.py -cfg='./config/cl4srec/cl4srec_ml1m.json' --mode=train
python executor.py -cfg='./config/cl4srec/cl4srec_ml1m.json' --mode=train_and_test
python executor.py -sc='./data/saved/cl4srec/ml1m/pre_64_2048_2_2/config.json' --mode=test

python executor.py -cfg='./config/cl4srec/cl4srec_appliances.json' --mode=train
python executor.py -cfg='./config/cl4srec/cl4srec_appliances.json' --mode=train_and_test
python executor.py -sc='./data/saved/cl4srec/appliances/pre_64_2048_2_2/config.json' --mode=test

python executor.py -cfg='./config/cl4srec/cl4srec_music.json' --mode=train
python executor.py -cfg='./config/cl4srec/cl4srec_music.json' --mode=train_and_test
python executor.py -sc='./data/saved/cl4srec/music/pre_64_2048_2_2/config.json' --mode=test

Duo4SRec

python executor.py -cfg='./config/duo4srec/duo4srec_ml1m.json' --mode=train
python executor.py -cfg='./config/duo4srec/duo4srec_ml1m.json' --mode=train_and_test
python executor.py -sc='./data/saved/duo4srec/ml1m/pre_64_2048_2_2/config.json' --mode=test

python executor.py -cfg='./config/duo4srec/duo4srec_appliances.json' --mode=train
python executor.py -cfg='./config/duo4srec/duo4srec_appliances.json' --mode=train_and_test
python executor.py -sc='./data/saved/duo4srec/appliances/pre_64_2048_2_2/config.json' --mode=test

python executor.py -cfg='./config/duo4srec/duo4srec_music.json' --mode=train
python executor.py -cfg='./config/duo4srec/duo4srec_music.json' --mode=train_and_test
python executor.py -sc='./data/saved/duo4srec/music/pre_64_2048_2_2/config.json' --mode=test

EC4SRec

python executor.py -cfg='./config/ec4srec/ec4srec_ml1m.json' --mode=train
python executor.py -cfg='./config/ec4srec/ec4srec_ml1m.json' --mode=train_and_test
python executor.py -sc='./data/saved/ec4srec/ml1m/pre_64_2048_2_2/config.json' --mode=test

python executor.py -cfg='./config/ec4srec/ec4srec_appliances.json' --mode=train
python executor.py -cfg='./config/ec4srec/ec4srec_appliances.json' --mode=train_and_test
python executor.py -sc='./data/saved/ec4srec/appliances/pre_64_2048_2_2/config.json' --mode=test

python executor.py -cfg='./config/ec4srec/ec4srec_music.json' --mode=train
python executor.py -cfg='./config/ec4srec/ec4srec_music.json' --mode=train_and_test
python executor.py -sc='./data/saved/ec4srec/music/pre_64_2048_2_2/config.json' --mode=test

EGPC

python executor.py -cfg='./config/egpc/egpc_ml1m.json' --mode=train
python executor.py -cfg='./config/egpc/egpc_ml1m.json' --mode=train_and_test
python executor.py -sc='./data/saved/egpc/ml1m/pre_64_2048_2_2/config.json' --mode=test

python executor.py -cfg='./config/egpc/egpc_appliances.json' --mode=train
python executor.py -cfg='./config/egpc/egpc_appliances.json' --mode=train_and_test
python executor.py -sc='./data/saved/egpc/appliances/pre_64_2048_2_2/config.json' --mode=test

python executor.py -cfg='./config/egpc/egpc_music.json' --mode=train
python executor.py -cfg='./config/egpc/egpc_music.json' --mode=train_and_test
python executor.py -sc='./data/saved/egpc/music/pre_64_2048_2_2/config.json' --mode=test

Caser

python executor.py -cfg='./config/caser/caser_ml1m.json' --mode=train
python executor.py -cfg='./config/caser/caser_ml1m.json' --mode=train_and_test
python executor.py -sc='./data/saved/caser/ml1m/64_8/config.json' --mode=test

python executor.py -cfg='./config/caser/caser_appliances.json' --mode=train
python executor.py -cfg='./config/caser/caser_appliances.json' --mode=train_and_test
python executor.py -sc='./data/saved/caser/appliances/64_8/config.json' --mode=test

python executor.py -cfg='./config/caser/caser_music.json' --mode=train
python executor.py -cfg='./config/caser/caser_music.json' --mode=train_and_test
python executor.py -sc='./data/saved/caser/music/64_8/config.json' --mode=test

PSAC

python executor.py -cfg='./config/psac/psac_gen_ml1m.json' --mode=train
python executor.py -cfg='./config/psac/psac_gen_ml1m.json' --mode=train_and_test
python executor.py -sc='./data/saved/psac_gen/ml1m/64_8/config.json' --mode=test

python executor.py -cfg='./config/psac/psac_gen_appliances.json' --mode=train
python executor.py -cfg='./config/psac/psac_gen_appliances.json' --mode=train_and_test
python executor.py -sc='./data/saved/psac_gen/appliances/64_8/config.json' --mode=test

python executor.py -cfg='./config/psac/psac_gen_music.json' --mode=train
python executor.py -cfg='./config/psac/psac_gen_music.json' --mode=train_and_test
python executor.py -sc='./data/saved/psac_gen/music/64_8/config.json' --mode=test

Refrence

  1. Xie X, Sun F, Liu Z, et al. Contrastive learning for sequential recommendation[C]//2022 IEEE 38th international conference on data engineering (ICDE). IEEE, 2022: 1259-1273.
  2. Qiu R, Huang Z, Yin H, et al. Contrastive learning for representation degeneration problem in sequential recommendation[C]//Proceedings of the fifteenth ACM international conference on web search and data mining. 2022: 813-823.
  3. Wang L, Lim E P, Liu Z, et al. Explanation guided contrastive learning for sequential recommendation[C]//Proceedings of the 31st ACM International Conference on Information & Knowledge Management. 2022: 2017-2027.
  4. Zhang Y, Li Y, Wang R, et al. PSAC: Proactive sequence-aware content caching via deep learning at the network edge[J]. IEEE Transactions on Network Science and Engineering, 2020, 7(4): 2145-2154.
  5. Tang J, Wang K. Personalized top-n sequential recommendation via convolutional sequence embedding[C]//Proceedings of the eleventh ACM international conference on web search and data mining. 2018: 565-573.