giuliowaitforitdavide / recsyslearn

GNU General Public License v3.0
7 stars 0 forks source link

Mantissa bug on summing proportion of items popularity #10

Closed giuliowaitforitdavide closed 1 year ago

giuliowaitforitdavide commented 1 year ago

When using the library if I try to segment the items in three different groups as follows

interaction_segmentator = InteractionSegmentation()
segmented_items_popularity = interaction_segmentator.segment(ml_100k, [0.6, 0.3, 0.1])

it returns me a WrongProportionError(). This is due to a mantissa representation problem, as explained here https://indepth.dev/posts/1139/here-is-what-you-need-to-know-about-javascripts-number-type

It could be solved by multiplying and then divide everything to 10 to the power of the decimal precision we want