Skip to content

Commit

Permalink
Update fsrs_optimizer.py
Browse files Browse the repository at this point in the history
  • Loading branch information
user1823 authored Oct 17, 2024
1 parent b2d13cc commit c9517e8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/fsrs_optimizer/fsrs_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ def init_d(self, rating: Tensor) -> Tensor:

def next_d(self, state: Tensor, rating: Tensor) -> Tensor:
delta_d = - self.w[6] * (rating - 3)
new_d = state[:, 1] + delta_d * (1 - (state[:, 1]/10)) # linear dampening
if delta_d > 0:
new_d = state[:, 1] + delta_d * (1 - (state[:, 1]/10))
if delta_d < 0:
new_d = state[:, 1] + delta_d * (1 - ((11 - state[:, 1])/10))
new_d = self.mean_reversion(self.init_d(4), new_d)
return new_d

Expand Down

0 comments on commit c9517e8

Please sign in to comment.