reciprocal_rank_fusion#
- scikitplot.mcp.reciprocal_rank_fusion(ranked_lists, *, k=60, key=<function _chunk_key>)[source]#
Fuse weighted ranked lists into a single
key -> scoremap.- Parameters:
- ranked_listssequence of (weight, items)
Each leg’s weight and its best-first ranked items.
- kint, optional
RRF constant, an
intof at least 1 (defaultDEFAULT_RRF_K).- keycallable, optional
Maps an item to its fusion identity, a non-empty
str(default_chunk_key).
- Returns:
- dict
identity -> fused score(higher is better), in fused order: descending score, ties by ascending identity.
- Raises:
- TypeError
If
kor a weight has the wrong type, orkeyreturns a non-str.- ValueError
If
k < 1, a weight is negative or not finite, or an identity is empty.
- Parameters:
- Return type:
Notes
R2-1: a thin adapter over
FusionPolicy, the rule shared byte for byte withscikitplot.corpus. Each leg is named by its position, so legs of equal weight stay distinct. The per-leg contributions the contract returns are not carried: an MCP result is aRetrievedChunk, which has no field for them.