Fitts Memory Scheduler
Spaced repetition scheduler combining SM-2 for interval scheduling with Fitts' Law for adaptive difficulty prediction.
Key Innovation: Dual-Signal Capture
Traditional flashcard apps only capture rating (subjective). This library captures both:
| Signal | Type | Source | Use |
|---|---|---|---|
| Rating | Subjective | User input | "How well did I recall?" → SM-2 intervals |
| Response Time | Objective | Measured | "How fast did I recall?" → Fitts calibration |
A user might:
- Respond fast but rate Hard (implicit memory worked, felt unsure)
- Respond slow but rate Easy (was distracted, knew the answer)
By capturing both, the model personalizes to each user.
Installation
[]
= "0.1"
Quick Start
use ;
Architecture
┌─────────────────────────────────────────────────────────────┐
│ ReviewInput │
│ ┌──────────────┬──────────────┐ │
│ │ Rating │ Response Time │ │
│ │ (subjective) │ (objective) │ │
│ └──────┬───────┴───────┬──────┘ │
│ │ │ │
│ ┌──────▼─────┐ ┌──────▼──────┐ │
│ │ SM-2 │ │ Fitts Law │ │
│ │ │ │ │ │
│ │ → interval │ │ → calibrate │ │
│ │ → ease │ │ → personalize│ │
│ └──────┬─────┘ └──────┬──────┘ │
│ │ │ │
│ ┌──────▼───────────────▼──────┐ │
│ │ ReviewResult │ │
│ │ • Updated card state │ │
│ │ • Predicted vs actual RT │ │
│ │ • Calibration results │ │
│ └─────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
Adaptive Calibration
The Fitts model learns from your actual response times using gradient descent:
use ;
let mut scheduler = with_learning_rate;
let card = default;
// Initial prediction
let = scheduler.predict;
println!;
// After 15 reviews, the model adapts
// If user consistently responds in ~2 seconds, model learns this
for _ in 0..15
let = scheduler.predict;
println!;
// Prediction now closer to 2 seconds
Algorithms
SM-2 (Wozniak, 1987)
Classic spaced repetition algorithm:
interval(0) = 1 day
interval(1) = 6 days
interval(n) = interval(n-1) × EF
EF' = EF + (0.1 - (5-q) × (0.08 + (5-q) × 0.02))
EF ≥ 1.3
Note: This implementation uses a 0-3 quality scale (Again/Hard/Good/Easy) instead of SM-2's original 0-5 scale. Quality values are linearly mapped to 1-5 internally for ease factor calculation: q_scaled = 1 + q × (4/3).
Fitts' Law (1954) + Memory Adaptation
Original (MacKenzie, 1992): MT = a + b × log₂(D/W + 1)
Memory adaptation:
- Distance = memory decay =
ln(1 + interval) / ease - Width = accessibility =
stability × ease - ID (Index of Difficulty) =
log₂(distance/accessibility + 1)
Formula: RT = a + b × ID
Gradient Descent Calibration (Pavlik & Anderson, 2008)
error = RT_actual - RT_predicted
a_new = a + α × error
b_new = b + α × error × ID
Where:
- α is the learning rate (default: 0.05)
- ID is the Index of Difficulty (already computed as log₂ term)
Retrievability (Memory Strength)
Uses logistic function based on response time:
R = 1 / (1 + exp((RT - τ) / σ))
- When RT < τ (threshold): R > 0.5 (likely to recall)
- When RT = τ: R = 0.5 (50/50 chance)
- When RT > τ: R < 0.5 (unlikely to recall)
API Reference
ReviewInput
// Full input with both signals
let input = new;
// Rating only (backward compatible)
scheduler.review;
FittsScheduler
// Default scheduler
let mut scheduler = new;
// With custom learning rate
let mut scheduler = with_learning_rate;
// Predict difficulty
let = scheduler.predict;
// Review with adaptation
let result = scheduler.review;
// Order cards by difficulty (hardest first)
scheduler.order_by_difficulty;
ReviewResult
Rating & DifficultyLevel
Both use 4 values for consistency:
| Rating | DifficultyLevel | SM-2 Quality | Status |
|---|---|---|---|
| Again | VeryHard | 0 | Failure |
| Hard | Hard | 1 | Success |
| Good | Medium | 2 | Success |
| Easy | Easy | 3 | Success |
Note: Rating is subjective user input. Only Again resets the card. All others (Hard, Good, Easy) advance the card interval.
Examples
# Basic usage
# SM-2 interval progression
# Fitts model predictions
# Adaptive calibration demo
Academic References
- SM-2: Wozniak, P.A. (1990). "Optimization of learning"
- Fitts' Law: Fitts, P.M. (1954). "The information capacity of the human motor system"
- ACT-R Memory: Anderson, J.R. (1993). "Rules of the Mind"
- Adaptive Scheduling: Pavlik, P.I. & Anderson, J.R. (2008). "Using a Model to Compute the Optimal Schedule of Practice"
- Duolingo HLR: Settles, B. & Meeder, B. (2016). "A Trainable Spaced Repetition Model for Language Learning"
License
MIT OR Apache-2.0