Skip to content
DeepForgeby svx
All problems
MediumNLPnlp-147

Hybrid Score Fusion

Problem

Fuse dense and sparse retrieval scores. Min-max normalize each score list to [0, 1], where a constant list becomes all 1.0.

Return alpha * dense_normalized + (1 - alpha) * sparse_normalized element-wise. Empty inputs give an empty list.

Hint

Normalize both lists independently before blending them with the alpha weight.

Test cases

case 1
in: [[0.2,0.8],[10,30],0.5]
expected: [0,1]
case 2
in: [[1,2,3],[0,0,0],0.25]
expected: [0.75,0.875,1]
case 3
in: [[5,5],[5,5],0.5]
expected: [1,1]
case 4
in: [[],[],0.5]
expected: []
Starter codePython
def hybrid_score_fusion(dense_scores, sparse_scores, alpha):
    # Your code here
    pass

4 test cases · run your code against them in the editor