QuantileAggregation
¶
QuantileAggregation(
q: Union[float, List[float]],
interpolation: QuantileInterpolations = "linear",
fill_value: float = 0.0,
)
Bases: Aggregation
Feature-wise \(q\)-th quantile of the elements of each set.
For every feature \(d\), with \(x_{\pi_1,d} \le \dots \le x_{\pi_n,d}\) the sorted values of a set of size \(n\), the quantile is read at position \(q \cdot (n - 1)\), interpolating between the two neighbouring values when this position is not an integer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q
|
Union[float, List[float]]
|
Quantile, or list of quantiles, in |
required |
interpolation
|
QuantileInterpolations
|
Interpolation between two values |
'linear'
|
fill_value
|
float
|
Output of empty sets. Default: |
0.0
|
Example:
import mlx.core as mx
from mlx_graphs.nn.aggr import QuantileAggregation
aggr = QuantileAggregation(q=[0.25, 0.75])
x = mx.random.normal((6, 16))
index = mx.array([0, 0, 1, 1, 1, 2])
>>> aggr(x, index).shape
(3, 32)
Source code in mlx_graphs/nn/aggr/quantile.py
from mlx_graphs.nn.aggr import QuantileAggregation · mlx_graphs/nn/aggr/quantile.py