Documentation

Fsrs6Scheduler
in package
implements SchedulerInterface

FinalYes

FSRS-6, the memory model Anki uses.

Each term carries Stability (days for recall probability to fall to 0.9), Difficulty (1..10) and, derived from those plus elapsed time, Retrievability. A graded review updates S and D; the next interval is whatever puts retrievability at the configured target.

Ported with no sub-day learning steps, which is exactly the reference implementation configured with an empty learning_steps — that branch sends a term straight to the Review state. LWT schedules in whole days, so sub-day steps would have nothing to express.

Deliberately omitted from phase 2a: interval fuzzing (it exists to spread Anki's daily load and would only add nondeterminism here) and the parameter optimiser (needs accumulated history — see review_log).

Table of Contents

Interfaces

SchedulerInterface
A spaced-repetition scheduler.

Properties

$decay  : float
$factor  : float
$params  : FsrsParameters

Methods

__construct()  : mixed
retrievability()  : float
Probability of recalling the term right now, in [0, 1].
review()  : SchedulingResult
Apply a graded review and return the resulting memory state.
clampDifficulty()  : float
clampStability()  : float
initialDifficulty()  : float
D after a first review: w4 - e^(w5 * (G-1)) + 1.
initialStability()  : float
S after a first review: w0..w3, indexed by grade.
nextDifficulty()  : float
D after a review: grade-driven delta, linearly damped near the ceiling, then reverted toward the "Easy" baseline by w7.
nextForgetStability()  : float
S after a lapse. Capped by the same-day term so a lapse can never increase stability.
nextInterval()  : int
Days until retrievability decays to the target retention.
nextRecallStability()  : float
S after a successful recall. The lower the retrievability at review time, the bigger the gain — reviewing something you almost forgot is worth more than reviewing something fresh.
nextStability()  : float
shortTermStability()  : float
S for a same-day repeat.

Properties

Methods

retrievability()

Probability of recalling the term right now, in [0, 1].

public retrievability(MemoryState|null $state, DateTimeImmutable $now) : float

Returns 0.0 for a term that has never been reviewed.

Parameters
$state : MemoryState|null
$now : DateTimeImmutable
Return values
float

review()

Apply a graded review and return the resulting memory state.

public review(MemoryState|null $current, Rating $rating, DateTimeImmutable $now) : SchedulingResult
Parameters
$current : MemoryState|null

The term's state, or null if it has never been graded (a first review).

$rating : Rating

The grade the user gave.

$now : DateTimeImmutable

When the review happened.

Return values
SchedulingResult

clampDifficulty()

private clampDifficulty(float $difficulty) : float
Parameters
$difficulty : float
Return values
float

clampStability()

private clampStability(float $stability) : float
Parameters
$stability : float
Return values
float

initialDifficulty()

D after a first review: w4 - e^(w5 * (G-1)) + 1.

private initialDifficulty(Rating $rating, bool $clamp) : float

Left unclamped when used as the mean-reversion target, which is what the reference does — clamping it there would bias the reversion.

Parameters
$rating : Rating
$clamp : bool
Return values
float

initialStability()

S after a first review: w0..w3, indexed by grade.

private initialStability(Rating $rating) : float
Parameters
$rating : Rating
Return values
float

nextDifficulty()

D after a review: grade-driven delta, linearly damped near the ceiling, then reverted toward the "Easy" baseline by w7.

private nextDifficulty(float $difficulty, Rating $rating) : float
Parameters
$difficulty : float
$rating : Rating
Return values
float

nextForgetStability()

S after a lapse. Capped by the same-day term so a lapse can never increase stability.

private nextForgetStability(float $difficulty, float $stability, float $retrievability) : float
Parameters
$difficulty : float
$stability : float
$retrievability : float
Return values
float

nextInterval()

Days until retrievability decays to the target retention.

private nextInterval(float $stability) : int
Parameters
$stability : float
Return values
int

nextRecallStability()

S after a successful recall. The lower the retrievability at review time, the bigger the gain — reviewing something you almost forgot is worth more than reviewing something fresh.

private nextRecallStability(float $difficulty, float $stability, float $retrievability, Rating $rating) : float
Parameters
$difficulty : float
$stability : float
$retrievability : float
$rating : Rating
Return values
float

nextStability()

private nextStability(float $difficulty, float $stability, float $retrievability, Rating $rating) : float
Parameters
$difficulty : float
$stability : float
$retrievability : float
$rating : Rating
Return values
float

shortTermStability()

S for a same-day repeat.

private shortTermStability(float $stability, Rating $rating) : float
Parameters
$stability : float
$rating : Rating
Return values
float
On this page

Search results