torch_geometric.nn.aggr.MedianAggregation

class MedianAggregation(fill_value: float = 0.0)[source]

Bases: QuantileAggregation

An aggregation operator that returns the feature-wise median of a set.

That is, for every feature \(d\), it computes

\[{\mathrm{median}(\mathcal{X})}_d = x_{\pi_i,d}\]

where \(x_{\pi_1,d} \le x_{\pi_2,d} \le \dots \le x_{\pi_n,d}\) and \(i = \lfloor \frac{n}{2} \rfloor\).

Note

If the median lies between two values, the lowest one is returned. To compute the midpoint (or other kind of interpolation) of the two values, use QuantileAggregation instead.

Parameters:

fill_value (float, optional) – The default value in the case no entry is found for a given index (default: 0.0).