Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing with ebisu>=3rc, obtaining a result of probabilityRecall = -1.52. Is this value correct? #65

Open
zxl777 opened this issue Feb 3, 2024 · 2 comments

Comments

@zxl777
Copy link

zxl777 commented Feb 3, 2024

Output:
probabilityRecall = -1.5234768228692503
28.509940322512662
8.099971706104066

Source:

# pip install "ebisu>=3rc"
# pip install attrs

import ebisu

# create an Ebisu model when the student has learned this flashcard
model = ebisu.initModel(
    firstHalflife=10, lastHalflife=10e3, firstWeight=0.9, numAtoms=5, initialAlphaBeta=2.0)

# at some point later, ask Ebisu for this flashcard's recall probability
timeSinceLastReview = 20
probabilityRecall = ebisu.predictRecall(model, timeSinceLastReview)
print("probabilityRecall =", probabilityRecall)

# administer a quiz, then update the model, overwriting the old one
timeSinceLastReview = 20.1
model = ebisu.updateRecall(model, successes=1, total=1,
                           elapsedTime=timeSinceLastReview)

# that's a binary quiz. You can also do a binomial quiz:
model = ebisu.updateRecall(model, successes=1, total=2,
                           elapsedTime=timeSinceLastReview)

# you can also do fuzzy-binary quizzes, see Ebisu v2 docs
model = ebisu.updateRecall(model, successes=0.85,
                           total=1, elapsedTime=timeSinceLastReview, q0=0.1)

# how long do we expect it to take for recall to drop to 50%?
print(ebisu.modelToPercentileDecay(model, 0.5))

# how long till recall drops to 80%?
print(ebisu.modelToPercentileDecay(model, 0.8))

# sometimes the model is just too hard or too easy. There's an ad hoc backdoor to rescaling it:
# new halflife = 0.25 * old halflife
easierModel = ebisu.rescaleHalflife(model, 0.25)
# new halflife = 4 * old halflife
harderModel = ebisu.rescaleHalflife(model, 4)

@fasiha
Copy link
Owner

fasiha commented Feb 3, 2024

Yah this is fine, predictRecall is returning log-probability. For real probability, pass in logDomain=False:

print([
  ebisu.predictRecall(model, timeSinceLastReview), # what you have
  ebisu.predictRecall(model, timeSinceLastReview, logDomain=False), # ask for linear domain
  2**ebisu.predictRecall(model, timeSinceLastReview) # do the exponential yourself
])
# -1.5234768228692503 0.34784661272006395 0.34784661272006395

@zxl777
Copy link
Author

zxl777 commented Feb 3, 2024

Thank you.

Looking forward to the new IPython Notebook crash course for 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants