Skip to content

Commit

Permalink
Fix/set terminal stability automatically (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock authored Jun 22, 2023
1 parent e55d77c commit 5620fcc
Show file tree
Hide file tree
Showing 3 changed files with 295 additions and 292 deletions.
576 changes: 288 additions & 288 deletions fsrs4anki_optimizer.ipynb

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions package/fsrs4anki_optimizer/fsrs4anki_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ def find_optimal_retention(self):
"""should not be called before predict_memory_states"""

base = 1.01
index_len = 664
index_offset = 200
minimum_stability = 0.1
index_offset = -(np.log(minimum_stability) / np.log(base)).round().astype(int)
d_range = 10
d_offset = 1
r_time = 8
Expand Down Expand Up @@ -609,7 +609,10 @@ def cal_next_recall_stability(s, r, d, response):
else:
return self.w[9] * np.power(d, self.w[10]) * np.power(s, self.w[11]) * np.exp((1 - r) * self.w[12])


terminal_stability = minimum_stability
for _ in range(128):
terminal_stability = cal_next_recall_stability(terminal_stability, 0.96, d_range, 1)
index_len = stability2index(terminal_stability)
stability_list = np.array([np.power(base, i - index_offset) for i in range(index_len)])
print(f"terminal stability: {stability_list.max(): .2f}")
df = pd.DataFrame(columns=["retention", "difficulty", "time"])
Expand Down
2 changes: 1 addition & 1 deletion package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "fsrs4anki_optimizer"
version = "3.25.3"
version = "3.25.4"
readme = "README.md"
dependencies = [
"matplotlib>=3.7.0",
Expand Down

0 comments on commit 5620fcc

Please sign in to comment.