Skip to content

Commit

Permalink
Increase sample size when "Days to simulate" is low.py (#122)
Browse files Browse the repository at this point in the history
* Increase sample size when "Days to simulate" is low.py

This is to prevent results from being noisy

* Improve the sample size rule.py

* fix UnboundLocalError

* bump version

---------

Co-authored-by: Jarrett Ye <jarrett.ye@outlook.com>
  • Loading branch information
Expertium and L-M-Sherlock authored Jul 24, 2024
1 parent b8293ef commit 86eeb69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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 = "5.0.1"
version = "5.0.2"
readme = "README.md"
dependencies = [
"matplotlib>=3.7.0",
Expand Down
10 changes: 7 additions & 3 deletions src/fsrs_optimizer/fsrs_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ def next_interval(s, r):
]
col = {key: i for i, key in enumerate(columns)}

SAMPLE_SIZE = 4


DEFAULT_LEARN_COSTS = np.array([33.79, 24.3, 13.68, 6.5])
DEFAULT_REVIEW_COSTS = np.array([23.0, 11.68, 7.33, 5.6])
DEFAULT_FIRST_RATING_PROB = np.array([0.24, 0.094, 0.495, 0.171])
Expand Down Expand Up @@ -257,6 +254,13 @@ def sample(
forget_session_len=DEFAULT_FORGET_SESSION_LEN,
):
memorization = []
if learn_span < 100:
SAMPLE_SIZE = 16
elif learn_span < 365:
SAMPLE_SIZE = 8
else:
SAMPLE_SIZE = 4

for i in range(SAMPLE_SIZE):
_, _, _, memorized_cnt_per_day, cost_per_day = simulate(
w,
Expand Down

0 comments on commit 86eeb69

Please sign in to comment.