Test new graph with GAT

Hi,
I’m using GAT and the code provided in the DGL library at this stage is able to test the graphs I put in the directory from scratch.

I’m wondering if I can use a pre-trained network for this case and test it with the new graph as well?
how should I change it?

Thanks

Sorry I don’t quite get it. You should be able to do that as long as you preprocess a new dataset in the same way of the original dataset. Do you have an example code so that I can take a look?

yes I think I should explain more.
so currently I’m using https://github.com/dmlc/dgl/blob/master/examples/pytorch/gat/train_ppi.py and for example I train my network for 2000 epoch and I have a pre-trained network now. If I want to test it on the new graphs then I should preprocess test data: create (test_labels.npy, …) and put it in the ppi file and train the network again from scratch since there’s no option for using pre-trained network.
so every time I want to test new graphs I should train it from scratch.
so the question is how to test it with new graphs without training from scratch?
let me know if you need more explanation.

Thanks,
Fatemeh

Hi Fatemeh,

You don’t need to re-train the model from scratch. DGL is only for dealing with graph neural networks and the rest is the same as PyTorch. After you train your model, you can save it first, see PyTorch’s tutorial on saving and loading models. When you have some new graphs, you need to first preprocess them so that their node features and labels are of the same size as PPI, and then you can simply apply the model to the new graphs and node features for prediction.

Thanks a lot it works now.