Skip to main content

FusionMethod

Enum FusionMethod 

Source
pub enum FusionMethod {
    Rrf {
        k: u32,
    },
    Isr {
        k: u32,
    },
    CombSum,
    CombMnz,
    Borda,
    Weighted {
        weight_a: f32,
        weight_b: f32,
        normalize: bool,
    },
    Dbsf,
    Standardized {
        clip_range: (f32, f32),
    },
    AdditiveMultiTask {
        weight_a: f32,
        weight_b: f32,
        normalization: Normalization,
    },
}
Expand description

Unified fusion method for dispatching to different algorithms.

Provides a single entry point for all fusion algorithms with a consistent API.

§Example

use rankops::FusionMethod;

let sparse = vec![("d1", 10.0), ("d2", 8.0)];
let dense = vec![("d2", 0.9), ("d3", 0.7)];

// Use RRF (rank-based, score-agnostic)
let fused = FusionMethod::Rrf { k: 60 }.fuse(&sparse, &dense);

// Use CombSUM (score-based)
let fused = FusionMethod::CombSum.fuse(&sparse, &dense);

Variants§

§

Rrf

Reciprocal Rank Fusion (ignores scores, uses rank position).

Fields

§k: u32

Smoothing constant (default: 60).

§

Isr

Inverse Square Root rank fusion (gentler decay than RRF).

Fields

§k: u32

Smoothing constant (default: 1).

§

CombSum

CombSUM — sum of normalized scores.

§

CombMnz

CombMNZ — sum × overlap count.

§

Borda

Borda count — N - rank points.

§

Weighted

Weighted combination with custom weights.

Fields

§weight_a: f32

Weight for first list.

§weight_b: f32

Weight for second list.

§normalize: bool

Whether to normalize scores before combining.

§

Dbsf

Distribution-Based Score Fusion (z-score normalization).

§

Standardized

Standardization-based fusion (ERANK-style).

Uses z-score normalization (standardization) instead of min-max normalization, then applies additive fusion. More robust to outliers and different score distributions. Based on ERANK (arXiv:2509.00520) which shows 2-5% NDCG improvement over CombSUM when score distributions differ significantly.

Fields

§clip_range: (f32, f32)

Clip z-scores to this range (default: [-3.0, 3.0]).

§

AdditiveMultiTask

Additive multi-task fusion (ResFlow-style).

Additive fusion of multi-task scores: α·score_a + β·score_b. ResFlow (arXiv:2411.09705) shows additive outperforms multiplicative for e-commerce.

Fields

§weight_a: f32

Weight for first task.

§weight_b: f32

Weight for second task.

§normalization: Normalization

Normalization method (default: ZScore for robustness).

Implementations§

Source§

impl FusionMethod

Source

pub const fn rrf() -> Self

Create RRF method with default k=60.

Source

pub const fn rrf_with_k(k: u32) -> Self

Create RRF method with custom k.

Source

pub const fn isr() -> Self

Create ISR method with default k=1.

Source

pub const fn isr_with_k(k: u32) -> Self

Create ISR method with custom k.

Source

pub const fn weighted(weight_a: f32, weight_b: f32) -> Self

Create weighted method with custom weights.

Source

pub const fn standardized(clip_range: (f32, f32)) -> Self

Create standardized fusion method (ERANK-style).

Uses z-score normalization (standardization) with clipping to prevent outliers. More robust than min-max when score distributions differ significantly.

Source

pub const fn standardized_default() -> Self

Create standardized fusion method with default clipping [-3.0, 3.0].

Source

pub const fn additive_multi_task(weight_a: f32, weight_b: f32) -> Self

Create additive multi-task fusion method (ResFlow-style).

Additive fusion outperforms multiplicative for e-commerce ranking. ResFlow’s optimal formula: CTR + CTCVR × 20.

Source

pub fn additive_multi_task_with_norm( weight_a: f32, weight_b: f32, normalization: Normalization, ) -> Self

Create additive multi-task fusion with custom normalization.

Source

pub fn fuse<I: Clone + Eq + Hash>( &self, a: &[(I, f32)], b: &[(I, f32)], ) -> Vec<(I, f32)>

Fuse two ranked lists using this method.

§Arguments
  • a - First ranked list (ID, score pairs)
  • b - Second ranked list (ID, score pairs)
§Returns

Combined list sorted by fused score (descending)

Source

pub fn fuse_multi<I, L>(&self, lists: &[L]) -> Vec<(I, f32)>
where I: Clone + Eq + Hash, L: AsRef<[(I, f32)]>,

Fuse multiple ranked lists using this method.

§Arguments
  • lists - Slice of ranked lists
§Returns

Combined list sorted by fused score (descending)

Trait Implementations§

Source§

impl Clone for FusionMethod

Source§

fn clone(&self) -> FusionMethod

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FusionMethod

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FusionMethod

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for FusionMethod

Source§

fn eq(&self, other: &FusionMethod) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for FusionMethod

Source§

impl StructuralPartialEq for FusionMethod

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.