fuse_by_rank#
- scikitplot.corpus.fuse_by_rank(results, *, rrf_k=60, weights=None, top_k=10)[source]#
Combine leg results by weighted reciprocal rank fusion.
- Parameters:
- resultsiterable of LegResult
One entry per leg. Failed legs contribute nothing but are harmless.
- rrf_kint, optional
The standard RRF constant, at least 1. Default 60.
- weightsdict, optional
Per-leg weight, finite and non-negative; unlisted legs weigh
1.0. A weight-0 leg contributes nothing and adds no document.- top_kint, optional
Number of fused hits to return.
- Returns:
- list of (hit, fused_score, contributions)
Descending fused score; ties by ascending identity (
doc_idornode_id).hitis the first hit seen for that identity.
- Raises:
- ValueError
If a hit has neither a
doc_idnor anode_id, or a weight orrrf_kis out of range.- TypeError
If a weight or
rrf_khas the wrong type.
- Parameters:
- Return type:
Notes
Developer. R2-1: the arithmetic and the tie-break are
FusionPolicy, the one rule shared withRetrievalIndex.searchand the MCP hybrid retriever. Rank fusion is the default combiner because score-space fusion needs a validated normalization that does not exist for most metrics (ADR-R07-003). Each hit’s contributions are returned, so the fused score can be recomputed and explained from the result.Fusion keys on
doc_id, never on a row offset – the property that kept F-R01-07’s positional coupling out of the fusion path. A hit without an identity is refused: an object address is not stable across processes.