open-spaced-repetition / py-fsrs

Python Package for FSRS
https://pypi.org/project/fsrs/
MIT License
147 stars 23 forks source link

Add file that summarizes the FSRS scheduler #57

Closed joshdavham closed 2 months ago

joshdavham commented 2 months ago

I've been finding myself repeatedly referring to both ishiko's ts-fsrs workflow diagram and the The Algorithm page and thought it'd be useful to include a file that gives a brief summary of how the FSRS scheduler works, at a high level.

I did omit some of the details of the implementation however, such as how a New card, when rated Again/Hard/Good, will be due in 1, 5 or 10 minutes, but I did this to keep things simple.

Please let me know if this looks okay, or if there are any issues 👍

Also, here's the link to the diagram if you're interested.

brainwo commented 2 months ago

I remade the diagram using Mermaid (embeddable in GitHub Markdown):

---
title: FSRS State Diagram
---
graph LR;
    new([New])--->|Again|learning([Learning]);
    new([New])--->|Hard|learning([Learning]);
    new([New])--->|Good|learning([Learning]);
    new-->|Easy|review([Review]);
    learning-->|Easy|review;
    learning-->|Good|review;
    learning-->|Again|learning;
    learning-->|Hard|learning;
    relearning([Relearning])-->|Good|review;
    relearning([Relearning])-->|Easy|review;
    relearning-->|Again|relearning;
    relearning--->|Hard|relearning;
    review-->|Hard|review;
    review-->|Good|review;
    review-->|Easy|review;
    review-.->|Again*|relearning;
    style new fill:#E3CBFE,stroke:#d577ff,color:#000
    style learning fill:#bde3ff,stroke:#22b4ff,color:#000
    style relearning fill:#bde3ff,stroke:#22b4ff,color:#000
    style review fill:#aff4c6,stroke:#65bf8c,color:#000
    linkStyle 1,7,11,12 color:orange;
    linkStyle 0,6,10 color:red;
    linkStyle 15 stroke:red,color:red;
    linkStyle 3,4,9,14 color:lime;
    linkStyle 2,5,8,13 color:cyan;
ishiko732 commented 2 months ago

It is important to note that this is a diagram for short-term scheduling and does not include scenarios for long-term scheduling. During the long-term scheduling process, the (Re)Learning state does not exist.

ishiko732 commented 2 months ago

I think it would be better to describe it using a piecewise function.

$$ S^\prime(D,S,R,G) = \begin{cases} S^\prime_f\big(D,S,R(t,S)\big) & \text{if } G = Again \ S^\prime_r\big(D,S,R(t,S),G\big) & \text{if } G = \text{Hard,Good,Easy} \end{cases} $$

joshdavham commented 2 months ago

Thanks for the feedback. I’m currently away from my computer but I’ll be back on monday and can review these changes then