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

Change S0 calculation to enforce Again < Hard < Good < Easy.py #132

Closed
wants to merge 2 commits into from
Closed
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
24 changes: 13 additions & 11 deletions src/fsrs_optimizer/fsrs_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ def __call__(self, module):
if hasattr(module, "w"):
w = module.w.data
w[0] = w[0].clamp(S_MIN, 100)
w[1] = w[1].clamp(S_MIN, 100)
w[2] = w[2].clamp(S_MIN, 100)
w[3] = w[3].clamp(S_MIN, 100)
# this ensures that w[n] is at least 5% greater than w[n-1], and also greater by at least 1 hour
w[1] = w[1].clamp(max(w[0] * 1.05, w[0] + 0.05), 100)
w[2] = w[2].clamp(max(w[1] * 1.05, w[1] + 0.05), 100)
w[3] = w[3].clamp(max(w[2] * 1.05, w[2] + 0.05), 100)
w[4] = w[4].clamp(1, 10)
w[5] = w[5].clamp(0.01, 4)
w[6] = w[6].clamp(0.01, 4)
Expand Down Expand Up @@ -1024,14 +1025,15 @@ def loss(stability):
(2, 4),
(1, 4),
):
if small_rating in rating_stability and big_rating in rating_stability:
# if rating_count[small_rating] > 300 and rating_count[big_rating] > 300:
# continue
if rating_stability[small_rating] > rating_stability[big_rating]:
if rating_count[small_rating] > rating_count[big_rating]:
rating_stability[big_rating] = rating_stability[small_rating]
else:
rating_stability[small_rating] = rating_stability[big_rating]
# if small_rating in rating_stability and big_rating in rating_stability:
# # if rating_count[small_rating] > 300 and rating_count[big_rating] > 300:
# # continue
# if rating_stability[small_rating] > rating_stability[big_rating]:
# if rating_count[small_rating] > rating_count[big_rating]:
# rating_stability[big_rating] = rating_stability[small_rating]
# else:
# rating_stability[small_rating] = rating_stability[big_rating]
rating_stability.sort()

w1 = 3 / 5
w2 = 3 / 5
Expand Down