MultiAggregation
¶
MultiAggregation(
aggrs: List[Union[Aggregation, str]],
aggrs_kwargs: Optional[List[Dict[str, Any]]] = None,
mode: CombineModes = "cat",
mode_kwargs: Optional[Dict[str, Any]] = None,
)
Bases: Aggregation
Applies several aggregations and combines their results, as in "Principal Neighbourhood Aggregation for Graph Nets" and "Adaptive Filters and Aggregator Fusion for Efficient Graph Convolutions" papers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aggrs
|
List[Union[Aggregation, str]]
|
List of aggregations: |
required |
aggrs_kwargs
|
Optional[List[Dict[str, Any]]]
|
Optional list (one dict per aggregation) of arguments
used to build the aggregations given by name. Default: |
None
|
mode
|
CombineModes
|
How the results are combined:
|
'cat'
|
mode_kwargs
|
Optional[Dict[str, Any]]
|
Arguments of the combine mode. |
None
|
Example:
import mlx.core as mx
from mlx_graphs.nn.aggr import MultiAggregation
aggr = MultiAggregation(["mean", "max", "std"])
x = mx.random.normal((6, 16))
index = mx.array([0, 0, 1, 1, 1, 2])
>>> aggr(x, index).shape
(3, 48)
Methods:
| Name | Description |
|---|---|
get_out_features_dim |
Output size for inputs with |
combine |
Combines the outputs of the aggregations according to |
Source code in mlx_graphs/nn/aggr/multi.py
get_out_features_dim
¶
Output size for inputs with node_features_dim features.
Source code in mlx_graphs/nn/aggr/multi.py
combine
¶
combine(inputs: List[array]) -> array
Combines the outputs of the aggregations according to mode.
Source code in mlx_graphs/nn/aggr/multi.py
from mlx_graphs.nn.aggr import MultiAggregation · mlx_graphs/nn/aggr/multi.py