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

Fix/index 0 is out of bounds when all duration is 0 #2

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ def optimizer(
difficulty_distribution = optimizer.difficulty_distribution.to_string().replace(
"\n", "\n\n"
)
plot_output = optimizer.find_optimal_retention(
learn_span=365, # days to learn
max_ivl=36500, # days
loss_aversion=2.5, # forget cost is multiplied by this factor to simulate loss aversion
)[0]
try:
plot_output = optimizer.find_optimal_retention(
learn_span=365, # days to learn
max_ivl=36500, # days
loss_aversion=2.5, # forget cost is multiplied by this factor to simulate loss aversion
)[0]
except:
print("Failed to find optimal retention")
optimizer.optimal_retention = 0.9
suggested_retention_markdown = (
f"""# Suggested Retention: `{optimizer.optimal_retention:.2f}`"""
)
Expand Down
Loading