Trainerflow

BaseFlow

NodeClassification

Node classification flow, The task is to classify the nodes of target nodes.

LinkPrediction

Link Prediction trainer flows.

Recommendation

Recommendation flows.

HetGNNTrainer

SkipGram flows.

HGTTrainer

HGTtrainer flows.

KGCNTrainer

Demo flows.

HeGANTrainer

Node classification flows.

Metapath2VecTrainer

HERecTrainer

HeCoTrainer

DMGI_trainer

SLiCETrainer

hde_trainer

HDE trainer flow.

GATNE

HANNodeClassification

HAN node classification flow.

HANLinkPrediction

HAN link prediction trainer flows.

Mg2vecTrainer

DHNE_trainer

DHNE trainer flow.

class BaseFlow(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

HeteroFeature

feature_preprocess(act)[源代码]
Feat

0, 1 ,2

Node feature

1 node type & more than 1 node types no feature

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.

preprocess()[源代码]

Preprocess for different models, e.g.: different optimizer for GTN. And prepare the dataloader foe train validation and test. Last, we will call preprocess_feature.

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.

preprocess()[源代码]

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.

class Recommendation(args=None)[源代码]

Recommendation flows.

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

HeteroFeature

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.

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

HeteroFeature

class HGTTrainer(args)[源代码]

HGTtrainer flows. Supported Model: HGT Supported Dataset:ogbn-mag

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

HeteroFeature

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

HeteroFeature

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)[源代码]
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

HeteroFeature

class HERecTrainer(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

HeteroFeature

class HeCoTrainer(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

HeteroFeature

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

HeteroFeature

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)[源代码]
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

HeteroFeature

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)[源代码]
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

HeteroFeature

class HANNodeClassification(args)[源代码]

HAN node classification flow.

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

HeteroFeature

class HANLinkPrediction(args)[源代码]

HAN link prediction trainer flows.

preprocess()[源代码]

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.

class Mg2vecTrainer(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

HeteroFeature

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

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

HeteroFeature