artefactual.scoring.wepr_reduction#
- artefactual.scoring.wepr_reduction(x, axis)[source]#
Weighted EPR features: the per-rank mean over tokens, then the per-rank max.
- Parameters:
x (ndarray of shape (..., n_tokens, k)) – Entropy contributions, NaN-padded; the last axis is the rank axis.
axis (int) – The token axis to reduce.
- Returns:
The mean branch then the max branch concatenated on the last axis, so 2k features per sequence, NaN where the sequence has no token. The “Mean of empty slice” and “All-NaN slice encountered” warnings are silenced inside this reduction, for the reason epr_reduction gives.
- Return type:
ndarray