benfred / implicit

Fast Python Collaborative Filtering for Implicit Feedback Datasets
https://benfred.github.io/implicit/
MIT License
3.57k stars 612 forks source link

Fix ALS loss calculation on GPU #663

Closed benfred closed 1 year ago

benfred commented 1 year ago

The GPU ALS model would sometimes return incorrect results with the calculate_training_loss parameter enabled. This happend when the number_of_users * number_of_items was bigger than 2**31 due to an overflow in the loss function calculation.

Fix and add tests that would have caught this bug

Closes https://github.com/benfred/implicit/issues/367 Closes https://github.com/benfred/implicit/issues/441