MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / smoothing_with_HGNN

Method smoothing_with_HGNN

easygraph/classes/hypergraph.py:1243–1261  ·  view source on GitHub ↗

r"""Return the smoothed feature matrix with the HGNN Laplacian matrix :math:`\mathcal{L}_{HGNN}`. .. math:: \mathbf{X} = \mathbf{D}_v^{-\frac{1}{2}} \mathbf{H} \mathbf{W}_e \mathbf{D}_e^{-1} \mathbf{H}^\top \mathbf{D}_v^{-\frac{1}{2}} \mathbf{X} Args:

(
        self, X: torch.Tensor, drop_rate: float = 0.0
    )

Source from the content-addressed store, hash-verified

1241 return self.group_cache[group_name]["L_HGNN"]
1242
1243 def smoothing_with_HGNN(
1244 self, X: torch.Tensor, drop_rate: float = 0.0
1245 ) -> torch.Tensor:
1246 r"""Return the smoothed feature matrix with the HGNN Laplacian matrix :math:`\mathcal{L}_{HGNN}`.
1247
1248 .. math::
1249 \mathbf{X} = \mathbf{D}_v^{-\frac{1}{2}} \mathbf{H} \mathbf{W}_e \mathbf{D}_e^{-1} \mathbf{H}^\top \mathbf{D}_v^{-\frac{1}{2}} \mathbf{X}
1250
1251 Args:
1252 ``X`` (``torch.Tensor``): The feature matrix. Size :math:`(|\mathcal{V}|, C)`.
1253 ``drop_rate`` (``float``): Dropout rate. Randomly dropout the connections in incidence matrix with probability ``drop_rate``. Default: ``0.0``.
1254 """
1255 if self.device != X.device:
1256 X = X.to(self.device)
1257 if drop_rate > 0.0:
1258 L_HGNN = sparse_dropout(self.L_HGNN, drop_rate)
1259 else:
1260 L_HGNN = self.L_HGNN
1261 return L_HGNN.mm(X)
1262
1263 def smoothing_with_HGNN_of_group(
1264 self, group_name: str, X: torch.Tensor, drop_rate: float = 0.0

Callers 4

test_smoothing_with_HGNNFunction · 0.80
forwardMethod · 0.80
forwardMethod · 0.80
forwardMethod · 0.80

Calls 2

sparse_dropoutFunction · 0.90
toMethod · 0.45

Tested by 1

test_smoothing_with_HGNNFunction · 0.64