r"""Return the HGNN Laplacian matrix :math:`\mathcal{L}_{HGNN}` of the specified hyperedge group with ``torch.sparse_coo_tensor`` format. .. math:: \mathcal{L}_{HGNN} = \mathbf{D}_v^{-\frac{1}{2}} \mathbf{H} \mathbf{W}_e \mathbf{D}_e^{-1} \mathbf{H}^\top \mathbf{D}_v^{-\frac{1}{
(self, group_name: str)
| 1211 | return self.cache["L_HGNN"] |
| 1212 | |
| 1213 | def L_HGNN_of_group(self, group_name: str) -> torch.Tensor: |
| 1214 | r"""Return the HGNN Laplacian matrix :math:`\mathcal{L}_{HGNN}` of the specified hyperedge group with ``torch.sparse_coo_tensor`` format. |
| 1215 | |
| 1216 | .. math:: |
| 1217 | \mathcal{L}_{HGNN} = \mathbf{D}_v^{-\frac{1}{2}} \mathbf{H} \mathbf{W}_e \mathbf{D}_e^{-1} \mathbf{H}^\top \mathbf{D}_v^{-\frac{1}{2}} |
| 1218 | |
| 1219 | Args: |
| 1220 | ``group_name`` (``str``): The name of the specified hyperedge group. |
| 1221 | """ |
| 1222 | assert ( |
| 1223 | group_name in self.group_names |
| 1224 | ), f"The specified {group_name} is not in existing hyperedge groups." |
| 1225 | if self.group_cache[group_name].get("L_HGNN") is None: |
| 1226 | _tmp = ( |
| 1227 | self.D_v_neg_1_2_of_group(group_name) |
| 1228 | .mm(self.H_of_group(group_name)) |
| 1229 | .mm(self.W_e_of_group(group_name)) |
| 1230 | .mm( |
| 1231 | self.D_e_neg_1_of_group(group_name), |
| 1232 | ) |
| 1233 | .mm( |
| 1234 | self.H_T_of_group(group_name), |
| 1235 | ) |
| 1236 | .mm( |
| 1237 | self.D_v_neg_1_2_of_group(group_name), |
| 1238 | ) |
| 1239 | ) |
| 1240 | self.group_cache[group_name]["L_HGNN"] = _tmp.coalesce() |
| 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 |