openhgnn.models.MAGNN¶
- class MAGNN(ntypes, h_feats, inter_attn_feats, num_heads, num_classes, num_layers, metapath_list, edge_type_list, dropout_rate, metapath_idx_dict, encoder_type='RotateE', activation=<function elu>)[source]¶
This is the main method of model MAGNN
- Parameters:
ntypes (list) – the nodes’ types of the dataset
h_feats (int) – hidden dimension
inter_attn_feats (int) – the dimension of attention vector in inter-metapath aggregation
num_heads (int) – the number of heads in intra metapath attention
num_classes (int) – the number of output classes
num_layers (int) – the number of hidden layers
metapath_list (list) – the list of metapaths, e.g [‘M-D-M’, ‘M-A-M’, …],
edge_type_list (list) – the list of edge types, e.g [‘M-A’, ‘A-M’, ‘M-D’, ‘D-M’],
dropout_rate (float) – the dropout rate of feat dropout and attention dropout
mp_instances (dict) – the metapath instances indices dict. e.g mp_instances[‘MAM’] stores MAM instances indices.
encoder_type (str) – the type of encoder, e.g [‘RotateE’, ‘Average’, ‘Linear’]
activation (callable activation function) – the activation function used in MAGNN. default: F.elu
Notes
Please make sure that the please make sure that all the metapath is symmetric, e.g [‘MDM’, ‘MAM’ …] are symmetric, while [‘MAD’, ‘DAM’, …] are not symmetric.
please make sure that the edge_type_list meets the following form: [edge_type_1, edge_type_1_reverse, edge_type_2, edge_type_2_reverse, …], like the example above.
All the activation in MAGNN are the same according to the codes of author.