MCPcopy Create free account
hub / github.com/PythonOT/POT / __init__

Method __init__

ot/gnn/_layers.py:65–154  ·  view source on GitHub ↗

r""" Template Fused Gromov-Wasserstein (TFGW) layer. This layer is a pooling layer for graph neural networks. Computes the fused Gromov-Wasserstein distances between the graph and a set of templates. .. math:: TFGW_{\overline{\mathcal{G}},\alpha}(C,F,h)=[FGW

(
        self,
        n_features,
        n_tplt=2,
        n_tplt_nodes=2,
        alpha=None,
        train_node_weights=True,
        multi_alpha=False,
        feature_init_mean=0.0,
        feature_init_std=1.0,
    )

Source from the content-addressed store, hash-verified

63 """
64
65 def __init__(
66 self,
67 n_features,
68 n_tplt=2,
69 n_tplt_nodes=2,
70 alpha=None,
71 train_node_weights=True,
72 multi_alpha=False,
73 feature_init_mean=0.0,
74 feature_init_std=1.0,
75 ):
76 r"""
77 Template Fused Gromov-Wasserstein (TFGW) layer. This layer is a pooling layer for graph neural networks.
78 Computes the fused Gromov-Wasserstein distances between the graph and a set of templates.
79
80
81 .. math::
82 TFGW_{\overline{\mathcal{G}},\alpha}(C,F,h)=[FGW_{\alpha}(C,F,h,\overline{C}_k,\overline{F}_k,\overline{h}_k)]_{k=1}^{K}
83
84 where :
85
86 - :math:`\mathcal{G}=\{(\overline{C}_k,\overline{F}_k,\overline{h}_k) \}_{k \in \{1,...,K \}} }` is the set of :math:`K` templates charactersised by their adjacency matrices :math:`\overline{C}_k`, their feature matrices :math:`\overline{F}_k` and their node weights :math:`\overline{h}_k`.
87 - :math:`C`, :math:`F` and :math:`h` are respectively the adjacency matrix, the feature matrix and the node weights of the graph.
88 - :math:`\alpha` is the trade-off parameter between features and structure for the Fused Gromov-Wasserstein distance.
89
90
91 Parameters
92 ----------
93 n_features : int
94 Feature dimension of the nodes.
95 n_tplt : int
96 Number of graph templates.
97 n_tplt_nodes : int
98 Number of nodes in each template.
99 alpha : float, optional
100 FGW trade-off parameter (0 < alpha < 1). If None alpha is trained, else it is fixed at the given value.
101 Weights features (alpha=0) and structure (alpha=1).
102 train_node_weights : bool, optional
103 If True, the templates node weights are learned.
104 Else, they are uniform.
105 multi_alpha: bool, optional
106 If True, the alpha parameter is a vector of size n_tplt.
107 feature_init_mean: float, optional
108 Mean of the random normal law to initialize the template features.
109 feature_init_std: float, optional
110 Standard deviation of the random normal law to initialize the template features.
111
112
113 References
114 ----------
115 .. [53] Cédric Vincent-Cuaz, Rémi Flamary, Marco Corneli, Titouan Vayer, Nicolas Courty.
116 "Template based graph neural network with optimal transport distances"
117
118 """
119 super().__init__()
120
121 self.n_tplt = n_tplt
122 self.n_tplt_nodes = n_tplt_nodes

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45

Tested by

no test coverage detected