Trainerflow¶
Node classification flow, The task is to classify the nodes of target nodes. |
|
Link Prediction trainer flows. |
|
Recommendation flows. |
|
SkipGram flows. |
|
HGTtrainer flows. |
|
Demo flows. |
|
Node classification flows. |
|
HDE trainer flow. |
|
HAN node classification flow. |
|
HAN link prediction trainer flows. |
|
DHNE trainer flow. |
- class BaseFlow(args)[源代码]¶
- class NodeClassification(args)[源代码]¶
Node classification flow, The task is to classify the nodes of target nodes. Note: If the output dim is not equal the number of classes, we will modify the output dim with the number of classes.
- class LinkPrediction(args)[源代码]¶
Link Prediction trainer flows. Here is a tutorial teach you how to train a GNN for link prediction <https://docs.dgl.ai/en/latest/tutorials/blitz/4_link_predict.html>_.
When training, you will need to remove the edges in the test set from the original graph. DGL recommends you to treat the pairs of nodes as another graph, since you can describe a pair of nodes with an edge. In link prediction, you will have a positive graph consisting of all the positive examples as edges, and a negative graph consisting of all the negative examples. The positive graph and the negative graph will contain the same set of nodes as the original graph. This makes it easier to pass node features among multiple graphs for computation. As you will see later, you can directly feed the node representations computed on the entire graph to the positive and the negative graphs for computing pair-wise scores.
- class Recommendation(args=None)[源代码]¶
Recommendation flows.
- class HetGNNTrainer(args)[源代码]¶
SkipGram flows.
Supported Model: HetGNN Supported Dataset:Academic4HetGNN Dataset description can be found in HetGNN paper. The trainerflow supports node classification and author link prediction.
- class HGTTrainer(args)[源代码]¶
HGTtrainer flows. Supported Model: HGT Supported Dataset:ogbn-mag
- class KGCNTrainer(args)[源代码]¶
Demo flows.
- preprocess(dataIndex)[源代码]¶
Every trainerflow should run the preprocess_feature if you want to get a feature preprocessing. The Parameters in input_feature will be added into optimizer and input_feature will be added into the model.
- input_feature¶
It will return the processed feature if call it.
- Type
- class HeGANTrainer(args)[源代码]¶
Node classification flows. Supported Model: HeGAN Supported Dataset:yelp The task is to classify the nodes of HIN(Heterogeneous Information Network). Note: If the output dim is not equal the number of classes, a MLP will follow the gnn model.
- class Metapath2VecTrainer(args)[源代码]¶
- class HERecTrainer(args)[源代码]¶
- class HeCoTrainer(args)[源代码]¶
- class DMGI_trainer(args)[源代码]¶
- preprocess()[源代码]¶
Every trainerflow should run the preprocess_feature if you want to get a feature preprocessing. The Parameters in input_feature will be added into optimizer and input_feature will be added into the model.
- input_feature¶
It will return the processed feature if call it.
- Type
- calculate_J(result, lbl)[源代码]¶
Two formulas to calculate the final objective \(\mathcal{J}\) If isSemi = Ture, introduce a semi-supervised module into our framework that predicts the labels of labeled nodes from the consensus embedding Z. More precisely, we minimize the cross-entropy error over the labeled nodes:
\[\begin{equation} \mathcal{J}_{\text {semi }}=\sum_{r \in \mathcal{R}} \mathcal{L}^{(r)}+\alpha \ell_{\mathrm{cs}}+\beta\|\Theta\|+\gamma \ell_{\text {sup }} \end{equation}\]Where \(\gamma\) is the coefficient of the semi-supervised module, the way to calculate \(\ell_{\text {sup }}\) :
\[\begin{equation} \ell_{\text {sup }}=-\frac{1}{\left|\mathcal{Y}_{L}\right|} \sum_{l \in \mathcal{Y}_{L}} \sum_{i=1}^{c} Y_{l i} \ln \hat{Y}_{l i} \end{equation}\]If isSemi = False:
\[\begin{equation} \mathcal{J}=\sum_{r \in \mathcal{R}} \mathcal{L}^{(r)}+\alpha \ell_{\mathrm{cs}}+\beta\|\Theta\|^{2} \end{equation}\]Where \(\alpha\) controls the importance of the consensus regularization, \(mathcal{L}^{(r)}\) is cross entropy.
- class SLiCETrainer(args)[源代码]¶
- class hde_trainer(args)[源代码]¶
HDE trainer flow. Supported Model: HDE Supported Dataset:imdb4hde The trainerflow supports link prediction task. It first calculates HDE for every node in the graph, and uses the HDE as a part of the initial feature for each node. And then it performs standard message passing and link prediction operations. Please notice that for different target node set, the HDE for each node can be different. For more details, please refer to the original paper: http://www.shichuan.org/doc/116.pdf
- class GATNE(args)[源代码]¶
- class HANNodeClassification(args)[源代码]¶
HAN node classification flow.
- class Mg2vecTrainer(args)[源代码]¶
- class DHNE_trainer(args)[源代码]¶
DHNE trainer flow. Supported Model: DHNE Supported Datase: drug, GPS, MovieLens, wordnet The trainerflow supports hypergraph embedding task. For more details, please refer to the original paper: https://arxiv.org/abs/1711.10146