Implementation of SM-2 in DART.
SM-2 is a simple spaced repetition algorithm. It calculates the number of days to wait before reviewing a piece of information based on how easily the information was remembered today.
- Spaced repetition on Wikipedia
- Official algorithm description
- Official implementation of SM-2 algorithm in SuperMemo 2
- http://www.supermemo.com
- http://www.supermemo.eu
The algorithm requires four inputs: quality
, repetitions
, previous ease factor
, and previous interval
. The last three inputs are taken from the output of a previous call to SM-2. (On the first call, default values are used.)
An integer from 0-5 indicating how easily the information was remembered today. This could correspond to a button such as "Difficult" or "Very Easy."
The official algorithm description explains the meaning of each number:
5 - perfect response
4 - correct response after a hesitation
3 - correct response recalled with serious difficulty
2 - incorrect response; where the correct one seemed easy to recall
1 - incorrect response; the correct one remembered
0 - complete blackout.
The number of times the information has been reviewed prior to this review. repetitions
should equal zero for the first review.
SM-2 uses this value to define specific intervals for the first and second reviews. SM-2 will also reset this value to zero when quality
is less than 3.
A floating point number (≥ 1.3) generated by the last iteration of the SM-2 algorithm. previous ease factor
should equal 2.5 for the first review.
The ease factor is used to determine the number of days to wait before reviewing again. Each call to SM-2 adjusts this number up or down based on quality
.
Generated by the last iteration of the SM-2 algorithm. Indicates the number of days to wait between reviews.
This previous interval is used when calculating the new interval. previous interval
should equal zero for the first review.
The algorithm returns three outputs: interval
, repetitions
, and ease factor
. All three values should be saved and passed to the next call to SM-2 as inputs.
An integer number indicating the number of days to wait before the next review.
The number of times the information has been reviewed as of this review.
This value is maintained between calls to the algorithm and used for calculating interval
. The number increments after each successful review. SM-2 will reset repetitions
to zero if quality
is less than 3.
A floating point number (≥ 1.3) which is adjusted up or down based on how easily the information was remembered.
This value is maintained between calls to the algorithm and is used for calculating interval
.
If quality
is greater than or equal to 3, indicating a correct response:
- If
repetitions
is 0 (first review), setinterval
to 1 day. - If
repetitions
is 1 (second review), setinterval
to 6 days. - If
repetitions
is greater than 1 (subsequent reviews), setinterval
toprevious interval * previous ease factor
. (See note about recursion below.) - Round
interval
up to the next whole number. - Increment
repetitions
by 1. - Set
ease factor
toprevious ease factor + (0.1 - (5 - quality) * (0.08 + (5 - quality ) * 0.02))
. (See formula description below.)
If quality
is less than 3, indicating an incorrect response:
- Set
repetitions
to 0. - Set
interval
to 1. - Set
ease factor
toprevious ease factor
(no change).
If ease factor
is less than 1.3:
- Set
ease factor
to 1.3.
Return interval
, repetitions
and ease factor
.
After the first two reviews, ease factor
is adjusted using this formula:
previous ease factor + (0.1 - (5 - quality) * (0.08 + (5 - quality) * 0.02))
The magic numbers come from the official algorithm description.
This increases ease factor
when quality
is 5, makes no change when quality
is 4, and decreases ease factor
by varying amounts when quality
is lower than 4. The lower quality
is, the more ease factor
is decreased.