This is a personal implementation for the task of Link Prediction.
python3
pytorch 1.5+
numpy
pandas
linkpred
dgl
- Predict by optimized_based method
python optimized_based.py
- For using different configs, you can modify global args in python file head.
A_path = './A_similarity.csv' # self matrix A csv path
B_path = './B_similarity.csv' # self matrix B csv path
A_B_path = './A_B_adjacent.csv' # correlation matrix between A and B csv path
hidden_edges_num = 4 # 4,8,16,32,64
algorithm='SimRank' # algorithm for modeling graph
- Predict by learning_based method
python learning_based.py
- For using different configs, you can modify global args in python file head.
A_path = './A_similarity.csv' # self matrix A csv path
B_path = './B_similarity.csv' # self matrix B csv path
A_B_path = './A_B_adjacent.csv' # correlation matrix between A and B csv path
hidden_edges_num = 4 # 4,8,16,32,64
embed_dim = 256 # node embedding size for input
mid_dim = 1024 # node feature size for gcn hidden layer
out_dim = 512 # node feature size for output
max_epoch = 200 # max training epooch
neg_node_num = 16 # neg node sample num
rebuild_graph = False # use for graph reconstruction task
avg_cnt = 3 # repeat number for avgeraging result
device=torch.device("cpu") # using cpu or gpu
- fix bugs in optimized_based.py
- fix bugs in learning_baesd.py
- clean and smiplify code for running faster
This project is released under the Apache 2.0 license. Please see the LICENSE file for more information.