AmenRa / ranx

⚡️A Blazing-Fast Python Library for Ranking Evaluation, Comparison, and Fusion 🐍
https://amenra.github.io/ranx
MIT License
427 stars 23 forks source link

Support `min-max-inverted` norm #65

Closed MochiXu closed 1 month ago

MochiXu commented 4 months ago

Background Introduction:

I need to perform a hybrid search using ranx and MyScaleDB. The principle is as follows:

When merging the vector search results and the BM25 query results, I need to normalize the scores. However, I only found the min-max normalization function suitable for BM25 scores. Therefore, I modified the code and added the min-max-inverted function to handle the normalization of vector search scores.

MochiXu commented 4 months ago

❤️ 👀 @diegoceccarelli

AndreP-git commented 4 months ago

I had a look with @diegoceccarelli and the main comment is that the metric has a lot of code shared with min-max . Couldn't you reuse the same code and add a parameter to change the way normalize results are computed? https://github.com/AmenRa/ranx/blob/master/ranx/normalization/min_max_norm.py#L29

@AmenRa what do you think?

MochiXu commented 4 months ago

@AndreP-git Following your advice, I have refined the code.

diegoceccarelli commented 4 months ago

@MochiXu thanks for contributing - @AndreP-git and I added some suggestions to your branch - please let us know what you think!

https://github.com/MochiXu/ranx/pull/1/files

MochiXu commented 3 months ago

@diegoceccarelli Thank you so much for refining my code. Your improvements will make ranx more user-friendly.

AmenRa commented 1 month ago

Hi everyone, I am deeply sorry for the delay! Thanks @MochiXu for the contribution. Thanks @diegoceccarelli and @AndreP-git for the code review / refine. Merging.