r"""Randomly drop hyperedges from the hypergraph. This function will return a new hypergraph with non-dropped hyperedges. Args: ``drop_rate`` (``float``): The drop rate of hyperedges. ``ord`` (``str``): The order of dropping edges. Currently, only ``'uniform'`` is su
(self, drop_rate: float, ord="uniform")
| 405 | self._clear_cache(group_name) |
| 406 | |
| 407 | def drop_hyperedges(self, drop_rate: float, ord="uniform"): |
| 408 | r"""Randomly drop hyperedges from the hypergraph. This function will return a new hypergraph with non-dropped hyperedges. |
| 409 | |
| 410 | Args: |
| 411 | ``drop_rate`` (``float``): The drop rate of hyperedges. |
| 412 | ``ord`` (``str``): The order of dropping edges. Currently, only ``'uniform'`` is supported. Defaults to ``uniform``. |
| 413 | """ |
| 414 | if ord == "uniform": |
| 415 | _raw_groups = {} |
| 416 | for name in self.group_names: |
| 417 | _raw_groups[name] = { |
| 418 | k: v |
| 419 | for k, v in self._raw_groups[name].items() |
| 420 | if random.random() > drop_rate |
| 421 | } |
| 422 | state_dict = { |
| 423 | "num_v": self.num_v, |
| 424 | "raw_groups": _raw_groups, |
| 425 | } |
| 426 | _hg = Hypergraph.from_state_dict(state_dict) |
| 427 | _hg = _hg.to(self.device) |
| 428 | else: |
| 429 | raise ValueError(f"Unknown drop order: {ord}.") |
| 430 | return _hg |
| 431 | |
| 432 | def drop_hyperedges_of_group( |
| 433 | self, group_name: str, drop_rate: float, ord="uniform" |
nothing calls this directly
no test coverage detected