| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
FSRS.Parameters
Description
The 35 weights of FSRS-7, and typed views onto the blocks they form.
FSRS-7 groups its weights like this:
w0..w3 | initial stability, indexed by rating |
w4..w6 | difficulty |
w7..w15 | stability update, long-term block |
w16..w24 | stability update, short-term (same-day) block |
| w25,w26 | the long-/short-term transition function |
+-----------+------------------------------------------------------------+
| w27..w34| the two-component forgetting curve |
+-----------+------------------------------------------------------------+
The two stability blocks have identical shapes, which is why
longTermWeights and shortTermWeights both produce a StabilityWeights.
Synopsis
- data Parameters
- parameterCount :: Int
- defaultParameters :: Parameters
- mkParameters :: [Double] -> Either [ParameterError] Parameters
- clampParameters :: [Double] -> Either [ParameterError] Parameters
- parametersToList :: Parameters -> [Double]
- parameterAt :: Parameters -> Int -> Double
- data ParameterError
- parameterBounds :: [(Double, Double)]
- validateParameters :: [Double] -> [ParameterError]
- initialStabilityWeight :: Parameters -> Rating -> Double
- initialDifficultyBase :: Parameters -> Double
- initialDifficultyRate :: Parameters -> Double
- difficultyDelta :: Parameters -> Double
- transitionRate :: Parameters -> Double
- transitionAmplitude :: Parameters -> Double
- data StabilityWeights = StabilityWeights {}
- longTermWeights :: Parameters -> StabilityWeights
- shortTermWeights :: Parameters -> StabilityWeights
- data CurveWeights = CurveWeights {}
- curveWeights :: Parameters -> CurveWeights
Parameters
data Parameters Source #
An FSRS-7 parameter vector: exactly parameterCount weights.
Build one with mkParameters or clampParameters; the constructor is
hidden so that the length invariant cannot be broken.
Instances
| Show Parameters Source # | |
Defined in FSRS.Parameters Methods showsPrec :: Int -> Parameters -> ShowS # show :: Parameters -> String # showList :: [Parameters] -> ShowS # | |
| Eq Parameters Source # | |
Defined in FSRS.Parameters | |
| Ord Parameters Source # | |
Defined in FSRS.Parameters Methods compare :: Parameters -> Parameters -> Ordering # (<) :: Parameters -> Parameters -> Bool # (<=) :: Parameters -> Parameters -> Bool # (>) :: Parameters -> Parameters -> Bool # (>=) :: Parameters -> Parameters -> Bool # max :: Parameters -> Parameters -> Parameters # min :: Parameters -> Parameters -> Parameters # | |
parameterCount :: Int Source #
35. FSRS-6 had 21 weights; FSRS-7 adds a second stability block, the
transition function and the six extra forgetting-curve weights.
defaultParameters :: Parameters Source #
The default FSRS-7 parameters, obtained by the upstream authors through multi-user optimisation.
These match models/fsrs_v7.py in
srs-benchmark.
Note that the Default Parameters section of that repository's README still
lists 1.15 for w15 and w24; that block of the README has not been
updated since 2026-03-18, while the model was changed to 1.3 three days
later. The values below follow the model.
mkParameters :: [Double] -> Either [ParameterError] Parameters Source #
Build a parameter vector, rejecting anything out of bounds.
clampParameters :: [Double] -> Either [ParameterError] Parameters Source #
Build a parameter vector by pulling every weight into its valid range, exactly as the upstream optimiser's clipper does: bounds first, in index order, so that the ordering constraints are resolved against already-clamped neighbours. Only a wrong number of weights can still fail.
parametersToList :: Parameters -> [Double] Source #
The weights as a plain list, in index order.
parameterAt :: Parameters -> Int -> Double Source #
The 0-based weight at the given index. Indices outside
[0, are a programmer error and raise an exception.parameterCount)
Validation
data ParameterError Source #
Why a list of weights is not a valid parameter vector.
Constructors
| WrongParameterCount !Int | Got this many weights instead of |
| ParameterOutOfBounds !Int !Double !Double !Double |
|
| ParameterOutOfOrder !Int !Int !Double !Double |
|
| ParameterNotFinite !Int !Double |
|
Instances
| Show ParameterError Source # | |
Defined in FSRS.Parameters Methods showsPrec :: Int -> ParameterError -> ShowS # show :: ParameterError -> String # showList :: [ParameterError] -> ShowS # | |
| Eq ParameterError Source # | |
Defined in FSRS.Parameters Methods (==) :: ParameterError -> ParameterError -> Bool # (/=) :: ParameterError -> ParameterError -> Bool # | |
parameterBounds :: [(Double, Double)] Source #
The inclusive (lower, upper) bound of every weight, in index order.
Taken from the parameter clipper the upstream optimiser applies after each gradient step, so any parameter set produced by a real optimiser satisfies them.
validateParameters :: [Double] -> [ParameterError] Source #
Every problem with a candidate weight list, or [] if there is none.
Weight blocks
initialStabilityWeight :: Parameters -> Rating -> Double Source #
w[rating - 1]: the stability a card is born with after its first review.
initialDifficultyBase :: Parameters -> Double Source #
w4.
initialDifficultyRate :: Parameters -> Double Source #
w5.
difficultyDelta :: Parameters -> Double Source #
w6.
transitionRate :: Parameters -> Double Source #
w25: how fast a review stops counting as same-day.
transitionAmplitude :: Parameters -> Double Source #
w26: how much of the short-term behaviour applies at zero elapsed time.
data StabilityWeights Source #
One of the two nine-weight blocks that drive the stability update.
Constructors
| StabilityWeights | |
Fields
| |
Instances
| Show StabilityWeights Source # | |
Defined in FSRS.Parameters Methods showsPrec :: Int -> StabilityWeights -> ShowS # show :: StabilityWeights -> String # showList :: [StabilityWeights] -> ShowS # | |
| Eq StabilityWeights Source # | |
Defined in FSRS.Parameters Methods (==) :: StabilityWeights -> StabilityWeights -> Bool # (/=) :: StabilityWeights -> StabilityWeights -> Bool # | |
longTermWeights :: Parameters -> StabilityWeights Source #
w7..w15: the block used for reviews separated by a real interval.
shortTermWeights :: Parameters -> StabilityWeights Source #
w16..w24: the block used for same-day reviews.
data CurveWeights Source #
w27..w34: the mixture of two power laws that makes up the FSRS-7
forgetting curve.
Constructors
| CurveWeights | |
Fields
| |
Instances
| Show CurveWeights Source # | |
Defined in FSRS.Parameters Methods showsPrec :: Int -> CurveWeights -> ShowS # show :: CurveWeights -> String # showList :: [CurveWeights] -> ShowS # | |
| Eq CurveWeights Source # | |
Defined in FSRS.Parameters | |
curveWeights :: Parameters -> CurveWeights Source #
Read the forgetting-curve block out of a parameter vector.