fasiha / ebisu

Public-domain Python library for flashcard quiz scheduling using Bayesian statistics. (JavaScript, Java, Dart, and other ports available!)
https://fasiha.github.io/ebisu
The Unlicense
311 stars 32 forks source link

Numerical instability with high α and β #68

Closed fasiha closed 1 month ago

fasiha commented 1 month ago
import ebisu

for ab in [
    400,  # this is ok: (400.95830291665123, 400.958302916993, 37.905799102514464)
    531.94,  # not ok: (30.00000000000004, 31.00000000000004, 38.010073575271555)
    531.9401709401171,  # throws AssertionError in _updateRecallSingle (negative newAlpha)
    600,  # throws AssertionError in _findBracket
]:
  print(ebisu.updateRecall((ab, ab, 37.98442774938748), 0, 1, 24.0))

We can fix this by calculating moments in the log-domain like we do in Mudder.js.