Skip to content

Commit e6c1c29

Browse files
authored
Feat/FSRS-6 (#732)
1 parent 3f92309 commit e6c1c29

3 files changed

Lines changed: 416 additions & 561 deletions

File tree

fsrs4anki_optimizer.ipynb

Lines changed: 394 additions & 541 deletions
Large diffs are not rendered by default.

fsrs4anki_scheduler.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// FSRS4Anki v5.3.4 Scheduler Qt6
1+
// FSRS4Anki v6.0.0 Scheduler Qt6
22
set_version();
33
// The latest version will be released on https://github.com/open-spaced-repetition/fsrs4anki/releases/latest
44

@@ -8,8 +8,7 @@ const deckParams = [
88
{
99
// Default parameters of FSRS4Anki for global
1010
"deckName": "global config for FSRS4Anki",
11-
"w": [0.40255, 1.18385, 3.173, 15.69105, 7.1949, 0.5345, 1.4604, 0.0046, 1.54575, 0.1192, 1.01925,
12-
1.9395, 0.11, 0.29605, 2.2698, 0.2315, 2.9898, 0.51655, 0.6621],
11+
"w": [0.2172, 1.1771, 3.2602, 16.1507, 7.0114, 0.57, 2.0966, 0.0069, 1.5261, 0.112, 1.0178, 1.849, 0.1133, 0.3127, 2.2934, 0.2191, 3.0004, 0.7536, 0.3332, 0.1437, 0.2],
1312
// The above parameters can be optimized via FSRS4Anki optimizer.
1413
// For details about the parameters, please see: https://github.com/open-spaced-repetition/fsrs4anki/wiki/The-Algorithm
1514
// User's custom parameters for global
@@ -21,17 +20,15 @@ const deckParams = [
2120
{
2221
// Example 1: User's custom parameters for this deck and its sub-decks.
2322
"deckName": "MainDeck1",
24-
"w": [0.40255, 1.18385, 3.173, 15.69105, 7.1949, 0.5345, 1.4604, 0.0046, 1.54575, 0.1192, 1.01925,
25-
1.9395, 0.11, 0.29605, 2.2698, 0.2315, 2.9898, 0.51655, 0.6621],
23+
"w": [0.2172, 1.1771, 3.2602, 16.1507, 7.0114, 0.57, 2.0966, 0.0069, 1.5261, 0.112, 1.0178, 1.849, 0.1133, 0.3127, 2.2934, 0.2191, 3.0004, 0.7536, 0.3332, 0.1437, 0.2],
2624
"requestRetention": 0.9,
2725
"maximumInterval": 36500,
2826
},
2927
{
3028
// Example 2: User's custom parameters for this deck and its sub-decks.
3129
// Don't omit any keys.
3230
"deckName": "MainDeck2::SubDeck::SubSubDeck",
33-
"w": [0.40255, 1.18385, 3.173, 15.69105, 7.1949, 0.5345, 1.4604, 0.0046, 1.54575, 0.1192, 1.01925,
34-
1.9395, 0.11, 0.29605, 2.2698, 0.2315, 2.9898, 0.51655, 0.6621],
31+
"w": [0.2172, 1.1771, 3.2602, 16.1507, 7.0114, 0.57, 2.0966, 0.0069, 1.5261, 0.112, 1.0178, 1.849, 0.1133, 0.3127, 2.2934, 0.2191, 3.0004, 0.7536, 0.3332, 0.1437, 0.2],
3532
"requestRetention": 0.9,
3633
"maximumInterval": 36500,
3734
}
@@ -97,7 +94,7 @@ if (Object.keys(params).length === 0) {
9794
var w = params["w"];
9895
var requestRetention = params["requestRetention"];
9996
var maximumInterval = params["maximumInterval"];
100-
const DECAY = -0.5;
97+
const DECAY = -w[20];
10198
const FACTOR = 0.9 ** (1 / DECAY) - 1;
10299
// global fuzz factor for all ratings.
103100
const fuzz_factor = set_fuzz_factor();
@@ -231,7 +228,11 @@ function next_forget_stability(d, s, r) {
231228
Math.exp((1 - r) * w[14]), sMin).toFixed(2);
232229
}
233230
function next_short_term_stability(s, rating) {
234-
return +(s * Math.exp(w[17] * (rating - 3 + w[18]))).toFixed(2);
231+
let sinc = Math.exp(w[17] * (rating - 3 + w[18])) * Math.pow(s, -w[19]);
232+
if (rating >= 3) {
233+
sinc = Math.max(sinc, 1);
234+
}
235+
return +(s * sinc).toFixed(2);
235236
}
236237
function init_states() {
237238
customData.again.d = init_difficulty("again");
@@ -316,7 +317,7 @@ function is_empty() {
316317
return !customData.again.d | !customData.again.s | !customData.hard.d | !customData.hard.s | !customData.good.d | !customData.good.s | !customData.easy.d | !customData.easy.s;
317318
}
318319
function set_version() {
319-
const version = "v5.3.4";
320+
const version = "v6.0.0";
320321
customData.again.v = version;
321322
customData.hard.v = version;
322323
customData.good.v = version;

fsrs4anki_scheduler_qt5.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// FSRS4Anki v5.3.4 Scheduler Qt5
1+
// FSRS4Anki v6.0.0 Scheduler Qt5
22
set_version();
33
// The latest version will be released on https://github.com/open-spaced-repetition/fsrs4anki/releases/latest
44

@@ -8,8 +8,7 @@ const deckParams = [
88
{
99
// Default parameters of FSRS4Anki for global
1010
"deckName": "global config for FSRS4Anki",
11-
"w": [0.40255, 1.18385, 3.173, 15.69105, 7.1949, 0.5345, 1.4604, 0.0046, 1.54575, 0.1192, 1.01925,
12-
1.9395, 0.11, 0.29605, 2.2698, 0.2315, 2.9898, 0.51655, 0.6621],
11+
"w": [0.2172, 1.1771, 3.2602, 16.1507, 7.0114, 0.57, 2.0966, 0.0069, 1.5261, 0.112, 1.0178, 1.849, 0.1133, 0.3127, 2.2934, 0.2191, 3.0004, 0.7536, 0.3332, 0.1437, 0.2],
1312
// The above parameters can be optimized via FSRS4Anki optimizer.
1413
// For details about the parameters, please see: https://github.com/open-spaced-repetition/fsrs4anki/wiki/The-Algorithm
1514
// User's custom parameters for global
@@ -21,17 +20,15 @@ const deckParams = [
2120
{
2221
// Example 1: User's custom parameters for this deck and its sub-decks.
2322
"deckName": "MainDeck1",
24-
"w": [0.40255, 1.18385, 3.173, 15.69105, 7.1949, 0.5345, 1.4604, 0.0046, 1.54575, 0.1192, 1.01925,
25-
1.9395, 0.11, 0.29605, 2.2698, 0.2315, 2.9898, 0.51655, 0.6621],
23+
"w": [0.2172, 1.1771, 3.2602, 16.1507, 7.0114, 0.57, 2.0966, 0.0069, 1.5261, 0.112, 1.0178, 1.849, 0.1133, 0.3127, 2.2934, 0.2191, 3.0004, 0.7536, 0.3332, 0.1437, 0.2],
2624
"requestRetention": 0.9,
2725
"maximumInterval": 36500,
2826
},
2927
{
3028
// Example 2: User's custom parameters for this deck and its sub-decks.
3129
// Don't omit any keys.
3230
"deckName": "MainDeck2::SubDeck::SubSubDeck",
33-
"w": [0.40255, 1.18385, 3.173, 15.69105, 7.1949, 0.5345, 1.4604, 0.0046, 1.54575, 0.1192, 1.01925,
34-
1.9395, 0.11, 0.29605, 2.2698, 0.2315, 2.9898, 0.51655, 0.6621],
31+
"w": [0.2172, 1.1771, 3.2602, 16.1507, 7.0114, 0.57, 2.0966, 0.0069, 1.5261, 0.112, 1.0178, 1.849, 0.1133, 0.3127, 2.2934, 0.2191, 3.0004, 0.7536, 0.3332, 0.1437, 0.2],
3532
"requestRetention": 0.9,
3633
"maximumInterval": 36500,
3734
}
@@ -99,7 +96,7 @@ if (Object.keys(params).length === 0) {
9996
const w = params["w"];
10097
const requestRetention = params["requestRetention"];
10198
const maximumInterval = params["maximumInterval"];
102-
const DECAY = -0.5;
99+
const DECAY = -w[20];
103100
const FACTOR = 0.9 ** (1 / DECAY) - 1;
104101
// global fuzz factor for all ratings.
105102
const fuzz_factor = set_fuzz_factor();
@@ -229,7 +226,11 @@ function next_forget_stability(d, s, r) {
229226
return +Math.min(w[11] * Math.pow(d, -w[12]) * (Math.pow(s + 1, w[13]) - 1) * Math.exp((1 - r) * w[14]), sMin).toFixed(2);
230227
}
231228
function next_short_term_stability(s, rating) {
232-
return +(s * Math.exp(w[17] * (rating - 3 + w[18]))).toFixed(2);
229+
let sinc = Math.exp(w[17] * (rating - 3 + w[18])) * Math.pow(s, -w[19]);
230+
if (rating >= 3) {
231+
sinc = Math.max(sinc, 1);
232+
}
233+
return +(s * sinc).toFixed(2);
233234
}
234235
function init_states() {
235236
customData.again.d = init_difficulty("again");
@@ -325,7 +326,7 @@ function is_empty() {
325326
return !customData.again.d | !customData.again.s | !customData.hard.d | !customData.hard.s | !customData.good.d | !customData.good.s | !customData.easy.d | !customData.easy.s;
326327
}
327328
function set_version() {
328-
const version = "v5.3.4";
329+
const version = "v6.0.0";
329330
customData.again.v = version;
330331
customData.hard.v = version;
331332
customData.good.v = version;

0 commit comments

Comments
 (0)