MLPEFeatEdgeDecoder
- class graphstorm.model.MLPEFeatEdgeDecoder(h_dim, feat_dim, out_dim, multilabel, target_etype, dropout=0, regression=False, num_ffn_layers=0, norm=None, use_bias=True)
Bases:
MLPEdgeDecoderMLP-based decoder for edge prediction tasks with edge features supported.
Parameters
- h_dim: int
The input dimension size. It is the dimension for both source and destination node embeddings.
- feat_dim: int
The input dimension size of edge features which are used for computing decoder output.
- out_dim: int
Output dimension size. If this decoder is for edge regression, the output dimension should be
1.- multilabel: bool
Whether this decoder is for multilabel edge classification.
- target_etype: tuple of str
The target etype for prediction in the format of (src_ntype, etype, dst_ntype).
- dropout: float
Dropout rate. Default: 0.
- regression: bool
Whether this decoder is for regression tasks. Default: False.
- num_ffn_layers: int
Number of FFN layers added to the decoder. Default: 0
- norm: str
Normalization methods. Not used, but reserved for complex MLPEFeatEdgeDecoder child class implementation. Default: None.
- use_bias: bool
Whether the edge decoder uses a bias parameter. Default: True.
Changed in version 0.4.0: Add a new argument “use_bias” so users can control whether decoders have bias.
- forward(g, h, e_h)
MLP-based edge feature supported edge decoder forward computation.
Parameters
- g: DGLGraph
The graph of target edges.
- h: dict of Tensor
The input node embeddings in the format of {ntype: emb}.
- e_h: dict of Tensor
The input edge embeddings in the format of {(src_ntype, etype, dst_ntype): emb}.
Returns
- out: Tensor
The prediction results.
- predict(g, h, e_h)
MLP-based edge feature supported edge decoder predict computation.
Parameters
- g: DGLGraph
The graph of target edges.
- h: dict of Tensor
The input node embeddings in the format of {ntype: emb}.
- e_h: dict of Tensor
The input edge embeddings in the format of {(src_ntype, etype, dst_ntype): emb}.
Returns
- out: Tensor
The prediction results.
- predict_proba(g, h, e_h)
MLP-based edge feature supported edge decoder predict computation and return the normalized prediction results if this decoder is for edge classification.
Parameters
- g: DGLGraph
The graph of target edges.
- h: dict of Tensor
The input node embeddings in the format of {ntype: emb}.
- e_h: dict of Tensor
The input edge embeddings in the format of {(src_ntype, etype, dst_ntype): emb}.
Returns
- out: Tensor
The prediction results. If this decoder is for edge classification, return the normalized prediction results.