Expand description
§FSRS-rs
The Free Spaced Repetition Scheduler (FSRS) is a modern spaced repetition algorithm. It springs from MaiMemo’s DHP model, which is a variant of the DSR model proposed by Piotr Wozniak.
FSRS-rs is a Rust implementation of FSRS. It also provides simulation capabilities and basic scheduling functionality.
For more information about the algorithm, please refer to the wiki page of FSRS.
Most of the functions in this crate require a struct input.
e.g. ComputeParametersInput and FSRSItem.
The most common struct is FSRS which holds the user’s parameters.
§Examples
use chrono::{Duration, Utc};
use fsrs::{FSRS, MemoryState};
let fsrs = FSRS::default();
let desired_retention = 0.9;
let previous_state: Option<MemoryState> = None;
let elapsed_days = 0;
let next_states = fsrs.next_states(previous_state, desired_retention, elapsed_days).unwrap();
let review = next_states.good;
let interval_days = review.interval.round().max(1.0) as u32;
let due = Utc::now() + Duration::days(interval_days as i64);There are more functions and structures. You can find them here.
Structs§
- CMRR
Target Fn - A struct holding a function which evaluation the quality.
- Card
- Holds the full state of a memory card.
- Combined
Progress State - Progress for the compute_parameters function.
- Compute
Parameters Input - Input parameters for computing FSRS parameters.
- FSRS
- This is the main structure provided by this crate.
- FSRS
Item - Stores a list of reviews for a card, in chronological order.
- FSRS
Review - A single review for a card, including the user’s rating and the number of days that passed.
- Item
Progress - The learning progress.
- Item
State - The state of an item after a review.
- Memory
State - Represents the memory state of an item in the FSRS system.
- Model
Evaluation - The evaluation metrics of a model.
- Next
States - The next states of an item after a review.
- Post
Scheduling Context - Context for post scheduling operations.
- Post
Scheduling Fn - Function type for post scheduling operations that takes a scheduling context and returns a new interval.
- Review
Priority Fn - Function type for review priority calculation that takes a card reference and returns a priority value (lower value means higher priority)
- Revlog
Entry - Represents a single review log entry.
- Simulation
Result - All output data you can get after the simulation ends.
- Simulator
Config - Training
Config - Hyperparameters used when training FSRS parameters.
Enums§
- FSRS
Error - Error types and Result alias for the crate. Represents an error that can occur during FSRS operations.
- Revlog
Review Kind - Represents the review kind of a review log entry.
Constants§
- FSRS5_
DEFAULT_ DECAY - The default decay for FSRS 5.
- FSRS6_
DEFAULT_ DECAY - The default decay for FSRS 6.
Statics§
- DEFAULT_
PARAMETERS - The default parameters. Fits the average person’s learning habits.
Functions§
- benchmark
- Assess how good or bad the current parameters are.
- check_
and_ fill_ parameters - Checks and fills the parameters with default values if necessary.
- compute_
parameters - Computes parameters for the FSRS model based on provided training data.
- current_
retrievability - Calculate the current retrievability for a memory state.
- evaluate_
with_ time_ series_ splits - Evaluates the model using time series cross-validation.
- expected_
workload - expected_
workload_ with_ existing_ cards - Evaluate expected workload when there are already in-flight cards.
- extract_
simulator_ config - Extracts the simulator configuration from the given review log entries.
- filter_
outlier - Filters out outlier reviews from two
Vec<FSRSItem>. - optimal_
retention - For the given simulator parameters and parameters, determine the suggested
desired_retentionvalue. - simulate