tot-prediction
Science Score: 31.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.1%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: THUDM
- Language: Python
- Default Branch: main
- Size: 41 KB
Statistics
- Stars: 3
- Watchers: 8
- Forks: 1
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
tot-prediction
Prerequisites
- Linux
- Python 3.9
- PyTorch 1.10.0+cu111
Getting Started
Installation
Clone this repo.
bash
git clone https://github.com/THUDM/tot-prediction.git
cd tot-prediction
Please install dependencies by
bash
pip install -r requirements.txt
Dataset
The dataset can be downloaded from BaiduPan with password f62u or Aliyun. Please put the data folder into the project directory.
How to Run
```bash python process.py
python citation_only.py # Use citation number only for prediction python regressor.py # Random Forest (RF) and GBRT python pagerank.py # PageRank python gnn.py # GraphSAGE ```
Results
Evaluation metrics: average MAP
| | MAP | |-------|-------| | Citation | 0.6413 | | RF | 0.5409 | | GBRT | 0.5725 | | PageRank | 0.6504 | | GraphSAGE | 0.0811 |
RGTN-NIE
cd RGTN-NIE
Prerequisites
- Python 3.10
- PyTorch 2.1
- dgl 2.1.0+cu118
Train
modify save-path in train_geni.sh and train_two.sh to save the model.
* run sh train_geni.sh for GENI in tot (full batch training)
* run sh train_two.sh for RGTN in tot (full batch training)
Inference
modify model_path in inference.sh and inference_two.sh to load the model.
modify output_dir in inference.sh and inference_two.sh to save the prediction results.
* run sh inference.sh for GENI in tot (full batch inference)
* run sh inference_two.sh for RGTN in tot (full batch inference)
Evaluation
python pagerank_nie.py
References
🌟 If you find our work helpful, please leave us a star and cite our paper.
@inproceedings{zhang2024oag,
title={OAG-bench: a human-curated benchmark for academic graph mining},
author={Fanjin Zhang and Shijie Shi and Yifan Zhu and Bo Chen and Yukuo Cen and Jifan Yu and Yelin Chen and Lulu Wang and Qingfei Zhao and Yuqing Cheng and Tianyi Han and Yuwei An and Dan Zhang and Weng Lam Tam and Kun Cao and Yunhe Pang and Xinyu Guan and Huihui Yuan and Jian Song and Xiaoyan Li and Yuxiao Dong and Jie Tang},
booktitle={Proceedings of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
pages={6214--6225},
year={2024}
}
Owner
- Name: THUDM
- Login: THUDM
- Kind: organization
- Email: keg.cs.tsinghua@gmail.com
- Location: FIT Building, Tsinghua University
- Website: https://huggingface.co/THUDM
- Twitter: thukeg
- Repositories: 98
- Profile: https://github.com/THUDM
ChatGLM, CogVLM, CodeGeeX, WebGLM, GLM-130B, CogView, CogVideo | CogDL, GNNs, AMiner | Knowledge Engineering Group (KEG) & Data Mining at Tsinghua University
Citation (citation_only.py)
import os
from tqdm import tqdm
from copy import deepcopy
from collections import defaultdict as dd
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.metrics import average_precision_score
import utils
def predict_with_only_citation():
venue_year_to_candidates = utils.load_json("data/", "venue_year_to_candidates_test.json")
tot_papers_test = utils.load_json("data/", "tot_papers_test.json")
cs_paper_list = utils.load_json("data/", "dpv12_last.json")
cs_paper_dict = {str(p["id"]): p for p in cs_paper_list}
venue_year_to_delta_year = {}
for paper in tqdm(tot_papers_test):
mid = paper["mag_id"]
p_hit = cs_paper_dict[mid]
vid = p_hit.get("venue", {}).get("id")
year = p_hit.get("year")
if vid and year:
cur_key = "{}_{}".format(vid, year)
year_award = paper["award_year"]
assert year_award > year
venue_year_to_delta_year[cur_key] = year_award - year
paper_per_year_citations = dd(lambda: dd(int))
for pid in tqdm(cs_paper_dict):
paper = cs_paper_dict[pid]
refs = paper.get("references", [])
year = paper["year"]
if refs is None:
continue
for ref_id in refs:
paper_per_year_citations[str(ref_id)][year] += 1
venue_year_to_scores = dd(dict)
for cur_key in tqdm(venue_year_to_candidates):
delta_year = min(10, venue_year_to_delta_year[cur_key])
year = int(cur_key.split("_")[-1])
cands = venue_year_to_candidates[cur_key]
for cid in cands:
cid = str(cid)
n_citation = 0
for yr in range(year, year + delta_year):
n_citation += paper_per_year_citations.get(cid, {}).get(yr, 0)
venue_year_to_scores[cur_key][cid] = n_citation
out_dir = "out/"
os.makedirs(out_dir, exist_ok=True)
utils.dump_json(venue_year_to_scores, out_dir, "venue_year_to_num_citations_test.json")
def eval_only_citation():
venue_year_to_scores = utils.load_json("out/", "venue_year_to_num_citations_test.json")
venue_year_to_candidates = utils.load_json("data/", "venue_year_to_candidates_test.json")
metrics = []
for cur_key in venue_year_to_candidates:
cur_pred = []
cur_labels = []
for cand in venue_year_to_candidates[cur_key]:
cur_labels.append(venue_year_to_candidates[cur_key][cand])
cur_pred.append(venue_year_to_scores[cur_key][cand])
cur_map = average_precision_score(cur_labels, cur_pred)
metrics.append(cur_map)
print(metrics)
print("mean map", np.mean(metrics))
if __name__ == "__main__":
predict_with_only_citation()
eval_only_citation()
GitHub Events
Total
- Watch event: 2
Last Year
- Watch event: 2
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Fanjin Zhang | z****l@1****m | 9 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0