Fix/index 0 is out of bounds when all duration is 0 (#2)
Browse files
app.py
CHANGED
@@ -84,11 +84,15 @@ def optimizer(
|
|
84 |
difficulty_distribution = optimizer.difficulty_distribution.to_string().replace(
|
85 |
"\n", "\n\n"
|
86 |
)
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
|
|
|
|
92 |
suggested_retention_markdown = (
|
93 |
f"""# Suggested Retention: `{optimizer.optimal_retention:.2f}`"""
|
94 |
)
|
|
|
84 |
difficulty_distribution = optimizer.difficulty_distribution.to_string().replace(
|
85 |
"\n", "\n\n"
|
86 |
)
|
87 |
+
try:
|
88 |
+
plot_output = optimizer.find_optimal_retention(
|
89 |
+
learn_span=365, # days to learn
|
90 |
+
max_ivl=36500, # days
|
91 |
+
loss_aversion=2.5, # forget cost is multiplied by this factor to simulate loss aversion
|
92 |
+
)[0]
|
93 |
+
except:
|
94 |
+
print("Failed to find optimal retention")
|
95 |
+
optimizer.optimal_retention = 0.9
|
96 |
suggested_retention_markdown = (
|
97 |
f"""# Suggested Retention: `{optimizer.optimal_retention:.2f}`"""
|
98 |
)
|