Skip to content

MedianAggregation

MedianAggregation(fill_value: float = 0.0)

Bases: QuantileAggregation

Feature-wise median 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\), it returns \(x_{\pi_i,d}\) with \(i = \lfloor (n - 1) / 2 \rfloor + 1\).

Note

If the median lies between two values, the lowest one is returned. Use QuantileAggregation for other interpolations.

Parameters:

Name Type Description Default
fill_value float

Output of empty sets. Default: 0.0

0.0
Source code in mlx_graphs/nn/aggr/quantile.py
def __init__(self, fill_value: float = 0.0):
    super().__init__(0.5, "lower", fill_value)

from mlx_graphs.nn.aggr import MedianAggregation · mlx_graphs/nn/aggr/quantile.py