PowerMeanAggregation
¶
PowerMeanAggregation(
p: float = 1.0,
learn: bool = False,
channels: int = 1,
clamp_min: Optional[float] = 0.0001,
clamp_max: Optional[float] = 100.0,
)
Bases: Aggregation
Power mean aggregation with an (optionally learnable) power, from "DeeperGCN: All You Need to Train Deeper GCNs" paper.
\[
\mathrm{powermean}(\mathcal{X}|p) = \left(\frac{1}{|\mathcal{X}|}
\sum_{\mathbf{x}_i\in\mathcal{X}}\mathbf{x}_i^{p}\right)^{1/p}.
\]
As in PyG, unless \(p = 1\), the inputs and the mean are clamped to
[clamp_min, clamp_max] (so the inputs are expected to be positive).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
float
|
Initial power. Default: |
1.0
|
learn
|
bool
|
If |
False
|
channels
|
int
|
Number of learnable powers, one per feature channel when
greater than 1. Requires |
1
|
clamp_min
|
Optional[float]
|
Lower bound of the clamping, or |
0.0001
|
clamp_max
|
Optional[float]
|
Upper bound of the clamping, or |
100.0
|
Methods:
| Name | Description |
|---|---|
reset_parameters |
Resets the power to its initial value. |
Source code in mlx_graphs/nn/aggr/basic.py
from mlx_graphs.nn.aggr import PowerMeanAggregation · mlx_graphs/nn/aggr/basic.py