dorianbrown / rank_bm25

A Collection of BM25 Algorithms in Python
Apache License 2.0
983 stars 83 forks source link

Replace division in `math.log()` with subtraction #23

Closed Witiko closed 3 months ago

Witiko commented 2 years ago

In the _calc_idf() method of BM25Plus, a division is used in math.log(), which is less stable than a subtraction of two logarithms. This PR replaces the division with subtraction,

dorianbrown commented 3 months ago

Sorry for the slow reaction, but this is a great change. I see now that I did this for the other _calc_idf methods, but not this one. Will get it merged!