Skip to content

Expertium/fsrs4anki

 
 

Repository files navigation

FSRS4Anki

FSRS4Anki

✨ A modern Anki custom scheduling based on Free Spaced Repetition Scheduler algorithm ✨

license release

Table of contents

Introduction

FSRS4Anki consists of three parts: scheduler, optimizer and helper add-on.

The scheduler replaces Anki’s built in scheduler. You can find the code here: https://github.com/open-spaced-repetition/fsrs4anki/blob/main/fsrs4anki_scheduler.js

The optimizer finds parameters that provide the best fit to your review history: https://colab.research.google.com/github/open-spaced-repetition/fsrs4anki/blob/v4.5.3/fsrs4anki_optimizer.ipynb

The add-on has many useful features, you can read about it here: https://github.com/open-spaced-repetition/fsrs4anki-helper

For more detail on the mechanism of the FSRS algorithm, please see my papers: A Stochastic Shortest Path Algorithm for Optimizing Spaced Repetition Scheduling (free access) and Optimizing Spaced Repetition Schedule by Capturing the Dynamics of Memory (submit request).

Installation

中文版请见:FSRS4Anki 使用指北

1. Enable the V3 scheduler in Anki

Go to Tools > Preferences > Review > Enable V3 Scheduler.

1

2. Export your deck or collection

Make sure to select “Include scheduling information” and “Support older Anki versions”.

2

Additionally, if you are worried about privacy, you can do the following before running the optimizer: Go to Browse > Notes > Find and Replace. Type (.|\n)* in the "Find" field and keep the "Replace With" field empty. Be sure to check (✓) the "Treat input as regular expression" option. Uncheck “Selected notes only” if you want to apply this to all notes.

14

This will make all fields in all your notes blank. PLEASE CREATE A BACKUP BEFORE DOING THIS! Then export your collection with blanked out fields. Again, this is not necessary, this is just an extra measure in case you are worried about privacy.

3. Go to the optimizer page and run the optimizer

https://colab.research.google.com/github/open-spaced-repetition/fsrs4anki/blob/v4.5.3/fsrs4anki_optimizer.ipynb

Click here to upload your deck/collection:

16

Replace collection-2022-09-18@13-21-58.colpkg with the name of your deck/collection. Collections have .colpkg at the end of the filename, and decks have .apkg. Replace ‘Asia/Shanghai’ with your timezone, there is a link to the list of timezones.

3

Go to Tools > Preferences > Review > Next day starts at to find out your value of next_day_starts_at.

4

To run the optimizer, either press Ctrl+F9 or go to Runtime > Run all.

5

4. Copy the optimal parameters

Go to section 2.2 (Result), the optimal parameters will be available there. Copy them and paste them somewhere temporarily.

6

5. Copy the scheduler code, paste it into Anki, and then paste the optimal parameters into it

Go to this page: https://github.com/open-spaced-repetition/fsrs4anki/blob/main/fsrs4anki_scheduler.js

Copy all of the code and paste it in the settings of any deck (it doesn’t matter which deck):

7

Copy the optimal parameters and paste them here:

8

Make sure that you don’t accidentally erase the square brackets or the comma after the closing bracket. The code will break without them.

Choose your requested retention and max. interval:

9

Higher requested retention leads to more reviews/day. FSRS’s "Maximum interval" overrides Anki’s built-in maximum interval.

Ensure that your learning and re-learning steps are no longer than 1 day for every single deck. Other settings, such as “Graduating interval” and “Easy interval”, don’t matter. For more details about which Anki settings matter and which are obsolete, see FAQ: https://github.com/open-spaced-repetition/fsrs4anki/wiki/FAQ

10

6. Use the helper add-on to reschedule all cards

Go to Tools > FSRS4Anki Helper > Reschedule all cards.

11

After rescheduling, you will likely see a lot of due cards, several times more than you are used to. This is typical. You can use the Postpone feature of the add-on to help you deal with the backlog. Read more about add-on features here: https://github.com/open-spaced-repetition/fsrs4anki-helper#overview

7. Extra

To check that FSRS in enabled, change this line of code:

12

If const display_memory_state = true; then you should be able to see something similar to this when reviewing a card:

13

If you don’t see D, S and R, and only see “FSRS enabled”, that means the card is in the “learning” or “relearning” stage, not in the “review” stage.

You can check some interesting FSRS statistics after installing the add-on and then pressing Shift+Left Mouse Button on Stats.

15

Advanced features

Using different parameters for different decks

You can also generate different parameters for different decks and configure them separately in the code. In the default configuration, deckParams already contains three groups of parameters.

The group "global config for FSRS4Anki" is global parameters.

The group "MainDeck1" are the parameters applied to the deck "MainDeck1" and its sub-decks.

Similarly, the third group is the parameters applied to the deck "MainDeck2::SubDeck::SubSubDeck" and its sub-decks. You can replace these with the decks you want to configure. If you need more, feel free to copy and add them.

const deckParams = [
  {
    // Default parameters of FSRS4Anki for global
    "deckName": "global config for FSRS4Anki",
    "w": [0.4, 0.6, 2.4, 5.8, 4.93, 0.94, 0.86, 0.01, 1.49, 0.14, 0.94, 2.18, 0.05, 0.34, 1.26, 0.29, 2.61],
    // The above parameters can be optimized via FSRS4Anki optimizer.
    // For details about the parameters, please see: https://github.com/open-spaced-repetition/fsrs4anki/wiki/The-Algorithm
    // User's custom parameters for global
    "requestRetention": 0.9, // recommended setting: 0.8 ~ 0.9
    "maximumInterval": 36500,
    // FSRS only modifies the long-term scheduling. So (re)learning steps in deck options work as usual.
    // I recommend setting steps shorter than 1 day.
  },
  {
    // Example 1: User's custom parameters for this deck and its sub-decks.
    "deckName": "MainDeck1",
    "w": [0.6, 0.9, 2.9, 6.8, 4.72, 1.02, 1, 0.04, 1.49, 0.17, 1.02, 2.15, 0.07, 0.35, 1.17, 0.32, 2.53],
    "requestRetention": 0.9,
    "maximumInterval": 36500,
  },
  {
    // Example 2: User's custom parameters for this deck and its sub-decks.
    // Don't omit any keys.
    "deckName": "MainDeck2::SubDeck::SubSubDeck",
    "w": [0.6, 0.9, 2.9, 6.8, 4.72, 1.02, 1, 0.04, 1.49, 0.17, 1.02, 2.15, 0.07, 0.35, 1.17, 0.32, 2.53],
    "requestRetention": 0.9,
    "maximumInterval": 36500,
  }
];

If there are some decks you don't want to use FSRS with, you can add their names to the skip_decks list.

const skip_decks = ["MainDeck3", "MainDeck4::SubDeck"];

FAQ

Here collect some questions from issues, forums, and others: FAQ

Compatibility

Some add-ons modify the scheduling of Anki, which would cause conflict with FSRS4Anki scheduler.

Add-on Compatible? Comment
Advanced Review Bottom Bar Yes✅ Please use the latest version.
Pass/Fail Yes✅ Pass is the equivalent of Good.
Incremental Reading v4.11.3 (unofficial clone) No❌ It shows intervals given by Anki's built-in scheduler, not the custom scheduler.
Auto Ease Factor No❌ Ease Factor doesn't affect intervals given by FSRS, so you won't benefit from using this add-on.
Delay siblings No❌ Delay siblings will modify intervals given by FSRS. However, FSRS already has similar functionality, so you don't need to use this add-on.
autoLapseNewInterval No❌ New Interval doesn't affect intervals given by FSRS, so you won't benefit from using this add-on.
Straight Reward No❌ Ease Factor doesn't affect intervals given by FSRS, so you won't benefit from using this add-on.

Let me know via issues if I miss any add-ons.

Contribute

You can contribute to FSRS4Anki by beta testing, submitting code, or sharing your data. If you want to share your data with me, please fill this form: https://forms.gle/KaojsBbhMCytaA7h8

Contributors

All Contributors

Expertium
Expertium

⚠️ 📖 🔣 🤔 🐛
user1823
user1823

⚠️ 📖 🔣 🤔 🐛

Stargazers over time

Star History Chart

About

A modern Anki custom scheduling based on free spaced repetition scheduler algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 99.9%
  • JavaScript 0.1%