This repository contains the source code and datasets for Learning Multiplex Representations on Text-Attributed Graphs with One Language Model Encoder, published in NeurIPs 2023 (GFrontiers).
- Requirements
- Overview
- Data
- Multiplex Representation Learning with METAG
- Downstream Task Inference
- Citations
The code is written in Python 3.8. Before running, you need to first install the required packages by typing following commands (Using a virtual environment is recommended):
pip3 install -r requirements.txt
METAG contains one language model encoder to learn multiplex representations for nodes on text-attributed graphs.
You can directly download the processed datasets here without conducting the following steps.
MAG data and Amazon data can be downloaded here: MAG Link and Amazon Link.
- Run the cells in
tools/generate_data_{mag/amazon}.ipynb
to generate sampled data for relation representation learning. - Run
src/scripts/prepare_data.sh
to obtain processed data (random sample and split into train/val/test).
- Run the cells in
tools/generate_downstream_{mag/amazon}.ipynb
to generate data for downstream tasks.
Train:
cd src/
bash run_train_{MAG/amazon}.sh
Test:
bash run_test_group_{MAG/amazon}.sh
bash downstream_match_test_zeroshot.sh
bash downstream_{class/regression/match}_train.sh
bash downstream_{class/regression/match}_test.sh
Please cite the following paper if you find the code helpful for your research.
@article{jin2023learning,
title={Learning Multiplex Embeddings on Text-rich Networks with One Text Encoder},
author={Jin, Bowen and Zhang, Wentao and Zhang, Yu and Meng, Yu and Zhao, Han and Han, Jiawei},
journal={arXiv preprint arXiv:2310.06684},
year={2023}
}