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 c9517e8 commit b30ba6b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/fsrs_optimizer/fsrs_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,8 @@ def init_d(self, rating: Tensor) -> Tensor:

def next_d(self, state: Tensor, rating: Tensor) -> Tensor:
delta_d = - self.w[6] * (rating - 3)
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))
test = state[:, 1] > 5.5
new_d = torch.where(test, state[:, 1] + delta_d * (1 - (state[:, 1]/10)), 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 b30ba6b

Please sign in to comment.