Documentation
¶
Overview ¶
Package learner is the virtual learner of the bench: its truth, which the bench knows and the learner model estimates from its attempts, and its calendar. The truth is the bench's own model, not learner-model's code: the bench measures the model on a learner it knows, not on a copy of itself. The base population holds the model's assumptions, and each population changes one of them, by a field of Assumptions.
Index ¶
- Constants
- Variables
- type Assumptions
- type Attempt
- type Calendar
- type Closure
- type Each
- type ItemResult
- type Learner
- func (l *Learner) Answer(t *pack.Task, at int64) (Attempt, error)
- func (l *Learner) Chance(t *pack.Task, item int, at int64, rung int) (float64, error)
- func (l *Learner) CorrectAfter() int
- func (l *Learner) Difficulty(t *pack.Task) float64
- func (l *Learner) DropAt() (int64, bool)
- func (l *Learner) LevelAt(module string, at int64) (float64, error)
- func (l *Learner) Module(id string) (*Module, error)
- func (l *Learner) NewCalendar() *Calendar
- func (l *Learner) PassLesson(m *pack.Module, lesson *pack.Lesson, at int64, each *Each) (Pass, error)
- func (l *Learner) Reference(id string, band int32) float64
- func (l *Learner) ReferenceAt(id string, band int32, at int64) float64
- func (l *Learner) Retention(s *Skill, at int64) float64
- func (l *Learner) Skill(id string) *Skill
- func (l *Learner) Solved() ([]string, []int64)
- func (l *Learner) SolvedAt(task string) (int64, bool)
- func (l *Learner) TaughtOn(id string) int32
- func (l *Learner) TrulyMastered(id string, band int32) bool
- func (l *Learner) TrulyMasteredAt(id string, band int32, at int64) bool
- func (l *Learner) Truth(id string, at int64) (float64, float64, bool)
- type Module
- type Pass
- type Skill
Constants ¶
const ( SheetItemSeconds = 120 WorkbookLineSeconds = 60 EssaySeconds = 900 LinkSeconds = 120 )
The time a learner spends, in seconds, on an item of a sheet, as in standalone, on a line of a workbook, on an essay, and on a link of a lesson that is no task — an explanation or a worked example —, an assumption of the bench. Answers after a rung take no time of their own: the next task comes at the time the attempt's items would.
const Mastery = 0.775
Mastery is the middle of the corridor of success, 0.775: the truth has mastered a skill on a band when P* of the reference task reaches it.
const Start int64 = 1788739200
Start is day 0 of every calendar, 2026-09-07 00:00:00 UTC, a Monday: every learner starts on the same day. The date is the bench's; only the days after it matter.
Variables ¶
var ErrAssumptions = errors.New("learner: the assumptions cannot be lived by")
ErrAssumptions is a population whose assumptions no learner can live by.
var ErrNoAnswer = errors.New("learner: the task has nothing to answer")
ErrNoAnswer is a task with no rubric and no cell to answer.
var ErrNoModule = errors.New("learner: no such module")
ErrNoModule is a learner given no module, or a task of a module it does not learn.
Functions ¶
This section is empty.
Types ¶
type Assumptions ¶
type Assumptions struct {
// BandStep is the true step between neighbouring bands, in logits: the shift 2.5 · (p − 1)
// of a start band and of a task's band.
BandStep float64
// StartSpread is the spread of the module's level around the start band, N(0, σ²).
StartSpread float64
// SkillSpread is the spread of a skill's offset from the module's level, N(0, σ²).
SkillSpread float64
// Miss multiplies a task's z, drawn once a task and a run: the author's miss of its difficulty.
Miss float64
// Slope is a of σ(a · (θ* + δ̄* − β*)).
Slope float64
// ChoiceGuess is the chance of guessing a choice of k options, times k: 1 gives 1/k, as the
// model has it; it is capped at 1.
ChoiceGuess float64
// PredicateGuess is the chance of guessing a cell of predicate; the model has 0.
PredicateGuess float64
// RungLift is what each rung of the ladder of hints adds to the logit of the items not yet right.
RungLift float64
// Forgets tells whether retention falls with time; false keeps it at 1.
Forgets bool
// LawC and LawF are C and F of the law of retention R* = (1 + F · Δt / τ*)^(−C), Δt and τ* in
// days.
LawC, LawF float64
// Growth is g, by which practice spaced out grows the stability.
Growth float64
// SessionChance is the chance that a day of the calendar has a session.
SessionChance float64
// SessionAttempts is the number of attempts of a session.
SessionAttempts int
// LevelShift moves the level of every module from the start band's: G1's 2.5 above or below.
LevelShift float64
// LearnLevel, LearnSkill and LearnReturn are what each first answer of an item with a verdict
// teaches (G2): the module's level grows by LearnLevel, the offsets of the item's primary skills
// by LearnSkill more, and the offset of every other skill of the module goes back LearnReturn of
// the way to where it started. LearnFade, when above 0, slows them as F/(F + k) at the k-th
// answer (G2-fading).
LearnLevel, LearnSkill, LearnReturn, LearnFade float64
// JumpBy moves the level of the module once, at an answer drawn from JumpFrom to JumpTo (G3,
// G3-drop).
JumpBy float64
JumpFrom, JumpTo int
// BandBias makes the tasks of one band of each module, drawn for the learner, truly harder by
// that much than the author named, beyond the miss (G4-band).
BandBias float64
// SkillHalves makes the first half of the skills of a module's graph stronger by that much and
// the second half weaker by as much (G5); a negative value turns it round.
SkillHalves float64
// TechniqueChance is the chance that an attempt takes the technique on request before its first
// answer, one fraction of the place attempts each attempt, and TechniqueLift what that adds to
// the logit of its items (G8).
TechniqueChance, TechniqueLift float64
// Adult makes a learner an adult without a grade (S-adult): the first band to start in, a level
// AdultFrom to AdultTo above it, drawn evenly, and the age category adult.
Adult bool
AdultFrom, AdultTo float64
// UnreadableEvery makes every UnreadableEvery-th answer of an item on a sheet unreadable first,
// written again (S-unreadable): no verdict and no mistake.
UnreadableEvery int
// The break of the calendar (F-): one break, starting on a day from BreakStartFrom to
// BreakStartTo, BreakMin to BreakMax days long, drawn evenly, ending by day BreakEndBy; and
// BreakDrop, by which the level of every module falls after it (F-break).
BreakStartFrom, BreakStartTo, BreakMin, BreakMax, BreakEndBy int
BreakDrop float64
// ExponentialLaw turns the law of retention into R* = LawBase^(Δt/τ*) (F-exp).
ExponentialLaw bool
LawBase float64
// AttemptShock is the spread of a shift N(0, σ²) of the logit of all items of an attempt, one
// for each attempt (W-shock).
AttemptShock float64
// ErrorChance is the chance that an attempt holds an error: every item with one of the task's
// primary skills is not yet right at its first answer (W-error).
ErrorChance float64
// BadDayChance is the chance that a day with a session is bad, and BadDayDrop by how much the
// level of every module falls on it (W-badday).
BadDayChance, BadDayDrop float64
// RepeatChance is P* of every item of a task, not a template, whose solution went to the device
// within RepeatDays days (W-repeat).
RepeatChance float64
RepeatDays int
// LevelCorrelation ties the levels of a learner's modules: the second and later draw their
// N(0, 1) as ρ·z₁ + √(1 − ρ²)·z (A-linked).
LevelCorrelation float64
// TeacherBoost makes the skills that teach an anchor skill stronger by that much: the learner
// knows the anchor outside the platform (A-unpractised).
TeacherBoost float64
// TeacherFades stops a skill that teaches an anchor skill from growing its stability, g = 0, once
// the truth has mastered it (A-fading).
TeacherFades bool
// AbandonChance is the chance that a pass of a lesson is abandoned at a link drawn evenly, one
// fraction and one link of the place attempts each pass (L-abandon).
AbandonChance float64
// ExplainLift makes the explanations and the worked examples of a lesson teach: at its first
// pass, the offsets of its skills grow by that much (L-explain).
ExplainLift float64
// LeaveChance is the chance that an attempt of a task with a rubric is left, closed "left", one
// fraction of the place attempts each such attempt (E-leave).
LeaveChance float64
// Grade fixes the learner's grade, the one the model starts by, among those its modules name, in
// place of the grade drawn from params; the draw is still made, so that params goes on in its
// order. Zero leaves the grade drawn (D-).
Grade int32
// TruthGrade is the grade whose start band shifts the truth's module level when it is not the
// learner's own: one truth under several grades, the model starting each by its own (D-). Zero
// shifts the level by the learner's own start band.
TruthGrade int32
// CorrectAfter makes an adult correct the module level once, to the band of the truth, by the
// evidence of a correction of learner-model, right after the attempt that brings the learner's
// first answers of items with a verdict to this many (C-). Zero leaves the level to the model.
CorrectAfter int
}
Assumptions are what a population assumes of its learners. Base gives the base population's; a population is Base with one field changed.
func Base ¶
func Base() Assumptions
Base gives the assumptions of the base population: the model's own, but the author's miss.
type Attempt ¶
type Attempt struct {
Task string // the task's full ID
Start int64 // when it was given, in seconds UTC
End int64 // when it closed
Seed uint64 // the attempt's seed, for the instance of a template
Items []ItemResult
Rungs int // the rungs of the ladder it reached, 0 to 3
Closure Closure
// Technique tells that the learner took the technique on request before its first answer.
Technique bool
// LeadingQuestion tells that the hint asked for gave the task's leading question too: the request
// of the technique gives it on a task that has one, with no lift of its own.
LeadingQuestion bool
}
Attempt is an attempt of a learner on a task.
type Calendar ¶
type Calendar struct {
// The break, days from BreakStart to BreakEnd, the last not included; none when they are equal.
BreakStart, BreakEnd int
// contains filtered or unexported fields
}
Calendar is a learner's days, sessions and the times its attempts are given: a day is a session with the population's chance, one fraction of the place calendar each day in order, and a session is the population's number of attempts in a row from sessionStart, the next given at once. Times are whole seconds UTC, as in evidence.
func (*Calendar) Done ¶
Done tells the calendar that the attempt given at Next closed at end: the next is given then.
func (*Calendar) EndSession ¶
func (c *Calendar) EndSession()
EndSession ends the session under way: the next attempt is given on the next day that has a session. The run calls it when the engine has nothing to give.
type Each ¶
type Each struct {
Before func(t *pack.Task, at int64) error
After func(t *pack.Task, a Attempt) error
End func(t *pack.Task, a Attempt) (int64, error)
}
Each is what a lesson's pass calls around each of its tasks, so that the caller reads the truth and the model between them, as they stand when the task is given and once it is answered. End, when given, is called last, at the end of the task's link: it gives when the next link is given, at the attempt's end or later — after a task of consolidation the caller gave outside the lesson.
type ItemResult ¶
type ItemResult struct {
Place int32
FirstRight bool // the first verdict of the item, the one the model reads
Right bool // whether it was right by the attempt's end
Wrong int // its wrong answers before it was right, or all of them
Unreadable bool // its first answer was unreadable and written again (S-unreadable)
Chance float64 // P* of its first answer, as the truth gave it
}
ItemResult is how one item of an attempt went.
type Learner ¶
type Learner struct {
Unit string // <population>/<n>
Age string // one age category, as a profile has one
// contains filtered or unexported fields
}
Learner is a virtual learner: its truth in each of its modules and its streams of draws.
func New ¶
func New(set seed.Set, population string, n int, modules []*pack.Module, a Assumptions) (*Learner, error)
New draws the n-th learner of a population of the set, in the given modules, from its places. A learner has one grade and one age category, as a profile has. Its truth comes from the place params, in a fixed order: the grade, among those every module with grades names, when they are more than one — drawn even where the population fixes it —; for each module by ID, the level and the offset of each skill with a verdict in the order of the graph; then, when no module gives a grade, the age category, among those every module names; and last what only some populations draw, for each module by ID — the answer of the jump, the band that is harder —, so that a population that draws more moves none of the others. Its calendar, answers, retries, attempts and attempt seeds come from places of their own, so that one never moves another.
func (*Learner) Answer ¶
Answer has the learner answer a task given at a time: the first answers of the items, one fraction of the place answers each in the items' order, then, after a wrong answer, again on each rung of the ladder, one fraction of the place retries for each item not yet right; with the fourth wrong answer the solution is shown — to a child by the adult's act, as by default, to a learner of the category adult by its own button. A task with a rubric is written, sent once and done. The attempt's seed is the next integer of the place attempt. Then the stability of each primary skill of the items moves once, by the share of its first verdicts that were right, and its last practice becomes the attempt's start.
func (*Learner) Chance ¶
Chance gives P* of an item of a task at a time and a rung of the ladder: c* + (1 − c*) · R̄* · σ(a · (θ* + δ̄* − β*) + lift · rung), c* the product over the item's cells of their guess, δ̄* and R̄* the means over the item's primary skills with a verdict.
func (*Learner) CorrectAfter ¶ added in v0.1.28
CorrectAfter gives the answers after which an adult corrects the learner's module level, 0 for none (C-).
func (*Learner) Difficulty ¶
Difficulty gives β* of a task: the true difficulty of its band and its difficulty, with the author's miss, z of the task's place times the population's Miss. z is drawn once a task and a run: the place of the task's unit and the purpose miss.
func (*Learner) DropAt ¶
DropAt gives the time the learner's break ends and its level falls, and whether it falls: F-break (M3 after a break). The break of the other F- populations drops nothing.
func (*Learner) NewCalendar ¶
NewCalendar gives the calendar of the learner's place calendar, made once and kept for the learner's bad days and its break. A population with a break draws it first: its start, then its length, evenly, so that it ends by BreakEndBy.
func (*Learner) PassLesson ¶
func (l *Learner) PassLesson(m *pack.Module, lesson *pack.Lesson, at int64, each *Each) (Pass, error)
PassLesson has the learner pass a lesson of a module given at a time, link by link in the author's order to its end: an explanation or a worked example takes two minutes and changes nothing of the truth but for L-explain, where the first one reached teaches the lesson's skills once; a task is answered as any task is. L-abandon leaves a pass at a link drawn evenly, and the next pass of the lesson goes on from that link. each, when given, is called around each task: Before when it is given, After once it is answered, End at the end of its link; the pass ends when its last link does.
func (*Learner) Reference ¶
Reference gives P* of the reference task of a skill on a band: c + (1 − c) · σ(a · (θ* + δ* − β)), c the guess of a choice of five options, β the band's true difficulty at difficulty 3, with no miss — the author's nor that of a whole band — and R* = 1. A skill the learner has no truth of gives 0.
func (*Learner) ReferenceAt ¶
ReferenceAt gives P* of the reference task of a skill on a band at a time: with the level then, as TrulyMasteredAt reads it, and the skill's R* then, c + (1 − c) · R* · σ (M5).
func (*Learner) Retention ¶
Retention gives R* of a skill at a time: the law of retention since its last attempt, at its stability; 1 before its first attempt, and always when the population does not forget.
func (*Learner) Solved ¶
Solved gives the tasks whose solution went to the device, and when it last did, in the order of their IDs.
func (*Learner) SolvedAt ¶
SolvedAt tells when the solution of a task last went to the device, if it did: when an attempt on it closed right or with the solution shown. The run reads it for the evidence and the summary, and W-repeat for its chance, so the fact has one source.
func (*Learner) TaughtOn ¶
TaughtOn gives the first band the graph teaches a skill on; 1 for a skill with no truth.
func (*Learner) TrulyMastered ¶
TrulyMastered tells whether the truth has mastered a skill on a band: P* of the reference task — difficulty 3 on that band, no miss, a choice of five options, R* = 1 — is at least 0.775, as "truly mastered" in standalone. It reads no number of the model: not its threshold, not its guess.
func (*Learner) TrulyMasteredAt ¶
TrulyMasteredAt is TrulyMastered at a time: with the level the truth has then, fallen after the break of F-break. A bad day is not counted: it lowers the answers of that day, not what the learner knows.
type Module ¶
type Module struct {
Pack *pack.Module
Grade learnermodel.Grade
StartBand int32 // the place of the band the learner, and so the model, starts in
TrueBand int32 // the place of the band whose shift the level has: StartBand, or TruthGrade's
Level float64 // θ*, the module's level; it is not forgotten
JumpAt int // the answer of the module at which its level jumps, when the population jumps
Answered int // first answers of items with a verdict in the module so far
HardBand int32 // the place of the band whose tasks are truly harder, when the population says so
}
Module is the learner's truth in one module.
type Pass ¶
type Pass struct {
Lesson string // the lesson's full ID
Start int64
End int64
Attempts []Attempt // the attempts on its tasks, in the author's order
Abandoned bool // the pass was left at a link (L-abandon)
}
Pass is a learner's pass of a lesson, link by link to its end, or to the link where it was left.
type Skill ¶
type Skill struct {
Module *Module
Offset float64 // δ*
Start float64 // δ* as it was drawn, which learning goes back to
Teacher bool // the skill teaches an anchor skill
TaughtOn int32 // the first band the graph teaches it on
Stability float64 // τ*, in days
Last int64 // the time of the last attempt on it, in seconds
Practised bool
}
Skill is the learner's truth of one skill with a verdict.