- https://arxiv.org/pdf/1806.01973.pdf
- https://github.com/dmlc/dgl/tree/master/examples/pytorch/pinsage
Pinsage Model Architecture | Pinsage Training Process | Pinsage Minibatch Process |
- python V # python version : 3.8.13
- dgl==0.9.1
- tqdm
- torch==1.9.1
- torchvision==0.10.1
- torchaudio==0.9.1
- torchtext==0.10.1
- dask
- partd
- pandas
- fsspec==0.3.3
- scipy
- scikit-learn
You must navigate to the "graph_data" folder and unzip the "kdata_entire8.zip" file. (Due to limited git capacity)
cd graph_data
unzip kdata_entire8.zip
The Docker image shows the result of calculating the Hitrate at k=500 as shown in the original paper. Based on the test data not used for training, the average of the subgraph embeddings of each user is obtained through the KNN algorithm, the distance from all items is obtained, the recommended list is obtained, and one of the labels not used for training is calculated as Hit.
# Build Docker Image
sudo docker build -t pinsage:v1 .
# Check generated Docker Image
sudo docker images
# Run generated docker image
sudo docker run pinsage:v1
result |
The install cmd is:
conda create -n your_prjname python=3.8
conda activate your_prjname
cd {Repo Directory}
pip install -r requirements.txt
- your_prjname : Name of the virtual environment to create
Download the trained weight file through the link below. This file is a trained file that learned the k-deep fashion dataset. Ensure that the weight file is located at "model/".
The testing cmd is:
python3 validation-kdeep.py
If you want to proceed with the new learning, adjust the parameters and set the directory and proceed with the command below.
The Training cmd is:
python3 training-kdeep.py
At the time of learning, recall@10 was set to metric to update the validation reference score. The example is as follows.
Training example |
- Pinsage Reference Result Tables in Original Paper
HR@K(=500) Score |
- Our Pinsage Model Performance Table
Embedding | Dataset | HR@K(=500) | HR@K(=50) | HR@K(=30) |
---|---|---|---|---|
Graph + Item meta | train(30,570)/valid(3,804)/test(3,910) | 74.5% | 54.8% | 38.2% |
Graph + Item meta | train(139,637)/valid(17,339)/test(17,936) | 92.6% | 74.8% | 49.6% |
Graph + Item meta | train(199,923)/valid(24,929)/test(25,645) | 80.7% | 53.0% | 40.2% |
- Example recommendations for Pinsage model's query items
K-Neareast Neighbors Result |