| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
FSRS.Parameters
Description
The 34 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..w14 | stability update, slow trace |
w15..w22 | stability update, fast trace |
w23..w30 | the two-component forgetting curve |
w31..w33 | how difficulty and stability modulate that curve |
The two stability blocks have identical shapes, which is why
slowTraceWeights and fastTraceWeights 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)]
- orderingConstraints :: [(Int, Int)]
- validateParameters :: [Double] -> [ParameterError]
- initialStabilityWeight :: Parameters -> Rating -> Double
- initialDifficultyBase :: Parameters -> Double
- initialDifficultyRate :: Parameters -> Double
- difficultyDelta :: Parameters -> Double
- data StabilityWeights = StabilityWeights {}
- slowTraceWeights :: Parameters -> StabilityWeights
- fastTraceWeights :: Parameters -> StabilityWeights
- data CurveWeights = CurveWeights {
- cwDecayBase1 :: !Double
- cwDecay2 :: !Double
- cwBase1 :: !Double
- cwBase2 :: !Double
- cwWeight1 :: !Double
- cwWeight2 :: !Double
- cwStabilityPower1 :: !Double
- cwStabilityPower2 :: !Double
- cwDifficultyWeight :: !Double
- cwDifficultyDecay :: !Double
- cwStabilityDecay1 :: !Double
- 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 #
34. FSRS-6 had 21 weights. FSRS-7 keeps two stability blocks of eight
weights each — one per memory trace — and spends eleven on a forgetting
curve that mixes the two traces and is modulated by difficulty.
defaultParameters :: Parameters Source #
The default FSRS-7 parameters, obtained by the upstream authors through multi-user optimisation.
These are the DEFAULT_PARAMETERS of the finished FSRS-7 reference
implementation, https://github.com/Expertium/fsrs-rs-speed-autoresearch.
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: every weight is clamped to its own bounds first, and only then are the ordering constraints restored by raising the larger index. 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.
orderingConstraints :: [(Int, Int)] Source #
Pairs (i, j) for which w[i] <= w[j] must hold: the initial stabilities
rise with the rating, and the slow component of the forgetting curve starts
above the fast one.
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.
data StabilityWeights Source #
One of the two eight-weight blocks that drive the stability update, one per memory trace.
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 # | |
slowTraceWeights :: Parameters -> StabilityWeights Source #
w7..w14: the block that updates the slow trace.
fastTraceWeights :: Parameters -> StabilityWeights Source #
w15..w22: the block that updates the fast trace.
data CurveWeights Source #
w23..w33: the mixture of two power laws that makes up the FSRS-7
forgetting curve, and the three weights that modulate it.
The last three are stored the way the reference stores them — shifted so that their range starts at zero — and the formulas in FSRS.Algorithm offset them back. The field documentation gives the offset each one carries.
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.