Skip to content

Commit

Permalink
Fix/index 0 is out of bounds when all duration is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Jun 5, 2024
1 parent d36cd6f commit a6ba03c
Showing 1 changed file with 9 additions and 5 deletions.
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

0 comments on commit a6ba03c

Please sign in to comment.