Skip to content

Commit

Permalink
decouple init_d_with_short_term
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Jul 26, 2024
1 parent 491c95c commit fc2dad8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/fsrs_optimizer/fsrs_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ def stability_short_term(s, init_rating=None):
return new_s

def init_d(rating):
new_d = w[4] - np.exp(w[5] * (rating - 1)) + 1
return w[4] - np.exp(w[5] * (rating - 1)) + 1

def init_d_with_short_term(rating):
rating_offset = np.choose(rating - 1, first_rating_offset)
new_d -= w[6] * rating_offset
new_d = init_d(rating) - w[6] * rating_offset
return np.clip(new_d, 1, 10)

def next_d(d, rating):
Expand Down Expand Up @@ -202,7 +204,7 @@ def mean_reversion(init, current):
card_table[col["stability"]][true_learn],
init_rating=card_table[col["rating"]][true_learn].astype(int),
)
card_table[col["difficulty"]][true_learn] = init_d(
card_table[col["difficulty"]][true_learn] = init_d_with_short_term(
card_table[col["rating"]][true_learn].astype(int)
)

Expand Down

0 comments on commit fc2dad8

Please sign in to comment.