fsrs

FSRS for Rust, including Optimizer and Scheduler

https://github.com/open-spaced-repetition/fsrs-rs

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.4%) to scientific vocabulary

Keywords

fsrs machine-learning rust spaced-repetition-algorithm

Keywords from Contributors

optimal-control reinforcement-learning anki anki-addon intelligent-tutoring-system memory spaced-repetition srs interactive network-simulation
Last synced: 6 months ago · JSON representation ·

Repository

FSRS for Rust, including Optimizer and Scheduler

Basic Info
  • Host: GitHub
  • Owner: open-spaced-repetition
  • License: bsd-3-clause
  • Language: Rust
  • Default Branch: main
  • Homepage: https://crates.io/crates/fsrs
  • Size: 1010 KB
Statistics
  • Stars: 283
  • Watchers: 9
  • Forks: 27
  • Open Issues: 1
  • Releases: 63
Topics
fsrs machine-learning rust spaced-repetition-algorithm
Created over 2 years ago · Last pushed 6 months ago
Metadata Files
Readme License Citation

README.md

FSRS for Rust

crates.io

This crate contains a Rust API for training FSRS parameters, and for using them to schedule cards.

The Free Spaced Repetition Scheduler (FSRS) is a modern spaced repetition algorithm. It is based on the DSR model proposed by Piotr Wozniak, the creator of SuperMemo.

FSRS-rs is a Rust implementation of FSRS. It is designed to be used in Anki, a popular spaced repetition software. Anki 23.10 has already integrated FSRS as an alternative scheduler.

For more information about the algorithm, please refer to the wiki page of FSRS.


Quickstart

Read this for an explanation of how to determine the optimal retention for your use case.

```rust // Pick whichever percentage is to your liking (see above) let optimal_retention = 0.75; // Use default parameters/weights for the scheduler let fsrs = FSRS::new(Some(&[]))?;

// Create a completely new card let day1states = fsrs.nextstates(None, optimal_retention, 0)?;

// Rate as hard on the first day let day1 = day1_states.hard; dbg!(&day1); // scheduled as in 4 days

// Now we review the card 2 days later let day3states = fsrs.nextstates(Some(day1.memory), optimal_retention, 2)?;

// Rate as good this time let day3 = day3_states.good; dbg!(day3); ```

Online development

You can use https://idx.google.com/import.

Local development

add

```sh

!/bin/sh

cargo fmt cargo clippy -- -D warnings git add . ```

to .git/hooks/pre-commit, then chmod +x .git/hooks/pre-commit

Bindings

Q&A

  • What is the difference between fsrs-rs and rs-fsrs

If you only want to schedule cards, use [lang]-fsrs or the bindings.

If you need to optimize, use this crate or its bindings.

  • Why use two crates instead of one?

Calculating the weights involves tensor operations so the data types are different (Tensor vs Vec/Slice). If we were to use one crate, this would mean using cfg to change the variable type, which would be tedious. Because of this, instead we publish two separate crates.

Another reason is, it would be hard to port to other languages while using Tensors.

  • What about the name?

Before this crate was made, go-fsrs and other libraries already existed, so the name rs-fsrs was chosen.

Then we wanted to port the torch version to Rust so that everyone could optimize on their own devices (tch-rs uses libtorch which is too heavy). Since the algorithm is called fsrs, we add an -rs on the end.

Owner

  • Name: Open Spaced Repetition
  • Login: open-spaced-repetition
  • Kind: organization

We are developing open-source spaced repetition algorithms for any spaced repetition software/system.

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: FSRS-rs
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - name: Open Spaced Repetition
repository-code: 'https://github.com/open-spaced-repetition/fsrs-rs'
abstract: >-
  FSRS-rs is a Rust implementation of FSRS for training FSRS
  parameters, and for using them to schedule cards.
keywords:
  - algorithm
  - machine learning
  - spaced repetition
license: BSD-3-Clause
commit: 222a93e954ff912abaf36878b96ebeeb9666e16b
version: 3.0.0
date-released: '2025-03-03'

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 285
  • Total Committers: 13
  • Avg Commits per committer: 21.923
  • Development Distribution Score (DDS): 0.418
Past Year
  • Commits: 118
  • Committers: 10
  • Avg Commits per committer: 11.8
  • Development Distribution Score (DDS): 0.441
Top Committers
Name Email Commits
Jarrett Ye j****e@o****m 166
Asuka Minato i@a****g 41
Damien Elmes d****e 36
Luc Mcgrady l****y@g****m 17
dependabot[bot] 4****] 8
Expertium 8****m 5
Alex Errant 1****t 4
sinepitc 9****c 3
user1823 9****3 1
ishiko i****2@g****m 1
Simon 8****s 1
Graeson Bergen 8****B 1
Alexander Haas m****l@h****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 23
  • Total pull requests: 184
  • Average time to close issues: 13 days
  • Average time to close pull requests: 3 days
  • Total issue authors: 13
  • Total pull request authors: 9
  • Average comments per issue: 3.78
  • Average comments per pull request: 1.2
  • Merged pull requests: 160
  • Bot issues: 0
  • Bot pull requests: 22
Past Year
  • Issues: 18
  • Pull requests: 163
  • Average time to close issues: 7 days
  • Average time to close pull requests: 3 days
  • Issue authors: 9
  • Pull request authors: 8
  • Average comments per issue: 3.06
  • Average comments per pull request: 1.23
  • Merged pull requests: 141
  • Bot issues: 0
  • Bot pull requests: 22
Top Authors
Issue Authors
  • sineptic (7)
  • L-M-Sherlock (7)
  • asukaminato0721 (6)
  • user1823 (2)
  • haasal (2)
  • GraesonB (1)
  • Samiisd (1)
  • joshdavham (1)
  • zsoltkacsandi (1)
  • zxl777 (1)
  • mikehardy (1)
  • aehlke (1)
  • TheBB (1)
  • jawadkho (1)
  • Expertium (1)
Pull Request Authors
  • L-M-Sherlock (126)
  • asukaminato0721 (38)
  • Luc-Mcgrady (36)
  • dependabot[bot] (22)
  • AlexErrant (9)
  • Expertium (7)
  • sineptic (5)
  • dae (3)
  • SimonBaars (2)
  • ishiko732 (2)
  • user1823 (1)
  • haasal (1)
  • ahmedyarub (1)
Top Labels
Issue Labels
question (3)
Pull Request Labels
enhancement (29) bug (25) dependencies (22) rust (21)

Packages

  • Total packages: 1
  • Total downloads:
    • cargo 211,790 total
  • Total docker downloads: 18,669,193
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 63
  • Total maintainers: 1
crates.io: fsrs

FSRS for Rust, including Optimizer and Scheduler

  • Versions: 63
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 211,790 Total
  • Docker Downloads: 18,669,193
Rankings
Dependent repos count: 29.7%
Dependent packages count: 35.0%
Average: 53.7%
Downloads: 96.5%
Maintainers (1)
Last synced: 6 months ago

Dependencies

Cargo.toml cargo
.github/workflows/check.yml actions
  • actions/cache v3 composite
  • actions/checkout v2 composite
  • dprint/check v2.2 composite
Cargo.lock cargo
  • 250 dependencies
.github/workflows/auto-merge.yml actions
  • actions/checkout v2 composite