Skip to content

Commit

Permalink
Fix/sample_size should be continuous over learn_span (#238)
Browse files Browse the repository at this point in the history
Co-authored-by: Jarrett Ye <[email protected]>
  • Loading branch information
Expertium and L-M-Sherlock authored Oct 16, 2024
1 parent 849dfa7 commit 81af1fa
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fsrs"
version = "1.3.2"
version = "1.3.3"
authors = ["Open Spaced Repetition"]
categories = ["algorithms", "science"]
edition = "2021"
Expand Down
2 changes: 1 addition & 1 deletion benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) fn calc_mem(inf: &FSRS, past_reviews: usize) -> MemoryState {
rating: 3,
delta_t: 21,
};
let reviews = repeat(review.clone()).take(past_reviews + 1).collect_vec();
let reviews = repeat(review).take(past_reviews + 1).collect_vec();
inf.memory_state(FSRSItem { reviews }, None).unwrap()
}

Expand Down
6 changes: 3 additions & 3 deletions src/optimal_retention.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,17 +403,17 @@ impl<B: Backend> FSRS<B> {
let maxiter = 64;
let tol = 0.01f32;

let default_sample_size = 16.0;
let sample_size = match config.learn_span {
..=30 => 90,
..=30 => 180,
31..365 => {
let (a1, a2, a3) = (8.20e-7, 2.41e-3, 1.30e-2);
let factor = (config.learn_span as f32)
.powf(2.0)
.mul_add(a1, config.learn_span as f32 * a2 + a3);
let default_sample_size = 8.0;
(default_sample_size / factor).round() as usize
}
365.. => 16,
365.. => default_sample_size as usize,
};

let (xb, fb) = (
Expand Down

0 comments on commit 81af1fa

Please sign in to comment.