Skip to content

Commit

Permalink
Fix/init s out of order (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Aug 8, 2023
1 parent bda6925 commit 1c28497
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,5 @@ meta
*.tsv
*.png
*.json
.fsrs_optimizer
.fsrs_optimizer
*.ipynb
2 changes: 1 addition & 1 deletion 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 = "FSRS-Optimizer"
version = "4.7.0"
version = "4.7.1"
readme = "README.md"
dependencies = [
"matplotlib>=3.7.0",
Expand Down
11 changes: 9 additions & 2 deletions src/fsrs_optimizer/fsrs_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,19 @@ def loss(stability):
plots.append(fig)
tqdm.write(str(rating_stability))

for a, b in ((1, 2), (2, 3), (3, 4)):
if a in rating_stability and b in rating_stability:
if rating_stability[a] > rating_stability[b]:
if rating_count[a] > rating_count[b]:
rating_stability[b] = rating_stability[a]
else:
rating_stability[a] = rating_stability[b]

if len(rating_stability) == 0:
raise Exception("Not enough data for pretraining!")
elif len(rating_stability) == 1:
init_stability = round(list(rating_stability.values())[0], 2)
for i in (0, 1, 2, 3):
self.init_w[i] = init_stability
self.init_w[0:4] = [init_stability] * 4
elif len(rating_stability) == 4:
for rating, stability in rating_stability.items():
self.init_w[rating-1] = round(stability, 2)
Expand Down

0 comments on commit 1c28497

Please sign in to comment.