Documentation
¶
Overview ¶
Package fuse implements score fusion methods to combine rankings from multiple retrieval methods (e.g., vector similarity + BM25).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RRFFusion ¶
type RRFFusion struct {
K int
}
RRFFusion implements Reciprocal Rank Fusion. Score = Σ 1 / (k + rank_i) where rank starts at 1.
func NewRRFFusion ¶
NewRRFFusion creates a new RRFFusion with the given constant k (default 60).
type WeightedFusion ¶
type WeightedFusion struct {
Alpha float64
}
WeightedFusion combines scores using a weighted sum. Alpha is the weight for the first score set; (1-alpha) is the combined weight of the remaining score sets, split evenly across them.
func NewWeightedFusion ¶
func NewWeightedFusion(alpha float64) *WeightedFusion
NewWeightedFusion creates a new WeightedFusion. Alpha should be in [0, 1].
func (*WeightedFusion) Fuse ¶
func (f *WeightedFusion) Fuse(scores ...map[string]float64) map[string]float64
Fuse combines scores using a weighted sum. With two score maps the result is alpha*s1 + (1-alpha)*s2. With N > 2 maps, alpha is the weight of the first map and (1-alpha) is split evenly across the remaining N-1 maps, so the per-map weights always sum to 1.