Documentation
¶
Overview ¶
Package seed gives the bench its numbers: every draw of sim comes from a place of randomness of the module format, a seed and names, by the platform's one generator. spec has the generator's test vectors but no Go code of it, so the place is built here, by Go's own PCG, and the vectors hold it to the format.
Index ¶
- Constants
- Variables
- func High(seed uint64, names ...string) (uint64, error)
- func Instance(attemptSeed uint64, task string, count int) (int, error)
- func Judgement(experiment string) (string, bool)
- func Learner(population string, n int) string
- func Task(module, task string) string
- type Set
- type Stream
Constants ¶
const ( CriterionModel = "model" CriterionEngine = "engine" CriterionPair = "pair" )
The criteria whose choices take held-out sets of their own.
const ( Params = "params" // the learner's truth Calendar = "calendar" // days, sessions and breaks Answers = "answers" // the first answers of items Retries = "retries" // the answers after a rung of the ladder or after unreadable Attempts = "attempts" // what each attempt holds: shocks, errors, techniques, abandons Attempt = "attempt" // the seed of each attempt, for the instances of templates Choice = "choice" // the seed of a choice of engine, if its rule ever draws at random Miss = "miss" // the author's miss of a task's difficulty )
The purposes of the places of a virtual learner and of a task.
Variables ¶
var ErrName = errors.New("seed: a name of a place is empty or holds |")
ErrName is a name of a place the format does not take: an empty one, or one with "|", which separates the names in the text the high word is hashed from.
var ErrNoConfirmation = errors.New("seed: no held-out set is recorded for the judgement")
ErrNoConfirmation is a judgement whose held-out set is not recorded.
var ErrNoInstance = errors.New("seed: a template has no instance")
ErrNoInstance is a template with no instance to choose from.
var ErrNotRecorded = errors.New("seed: no such held-out set is recorded in the decision log")
ErrNotRecorded is a held-out set the decision log has not recorded yet.
var Working = Set{Seed: 20261107, Experiment: "working"}
Working is the set of working learners: the gate and the decisive runs take the same ones.
Functions ¶
func High ¶
High gives the high word of the state of the place of seed and names: FNV-1a 64 over the UTF-8 of the seed in decimal followed, for each name, by "|" and the name. The low word is the seed.
func Instance ¶
Instance gives the number of the instance of a template that an attempt takes, as the platform chooses it: below(count) of the place of the attempt's seed with the names template, the task's ID and instance. Nothing else draws from that place. count is the number of the template's instances, numbered from 0.
func Judgement ¶ added in v0.1.17
Judgement gives the judgement whose confirmation a held-out set is, if any.
Types ¶
type Set ¶
Set is a set of virtual learners: a seed and the name of its experiment, the first name of every place it draws from. Sets that must stay apart take seeds of their own, as the format bids ("a use that needs streams apart from another's takes a seed of its own").
func Confirmation ¶ added in v0.1.17
Confirmation gives the held-out set a judgement's confirmation runs on, by the judgement's name.
func HeldOut ¶
HeldOut gives the held-out set of the n-th choice of a criterion: experiment held-out-<criterion>-<n>, at the seed the decision log recorded for it.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream is the stream of draws of one place of randomness. The format's five functions are its methods, each Go's own method of math/rand/v2 on the same PCG, drawing the same integers in the same order.
func (*Stream) Below ¶
Below draws an integer from 0 to bound − 1: the format's below, Go's Uint64N. bound is above 0.
func (*Stream) Between ¶
Between draws an integer from a to c, both included: the format's between, a + Int64N(c − a + 1). a is not above c, and c − a + 1 fits in an int64.
func (*Stream) Exponential ¶
Exponential draws a number of the exponential distribution with mean 1: −ln(1 − u) at one fraction u. 1 − u is above 0, since u is below 1.
func (*Stream) Fraction ¶
Fraction draws a number in [0, 1): the format's fraction, Go's Float64, the low 53 bits of an integer divided by 2^53. Go's Float64 is inlined, and its product could fuse with what its caller does next — 1 − u, or u − 0.5, into one step on arm64 that rounds once —, so the result goes through float64(), which the Go specification makes round ("An explicit floating-point type conversion rounds to the precision of the target type, preventing fusion"). "Go / fma-diff" holds it.
func (*Stream) Normal ¶
Normal draws a number of the standard normal distribution: the inverse of its distribution function at one fraction, by Wichura's algorithm AS 241, PPND16, which is good to about 1e-16. A fraction of exactly 0 — one draw in 2^53 — is taken as 2^−53, the smallest one above it, so the result is finite and the two tails end at the same distance: the largest 1 − u is 2^−53 too.
func (*Stream) Permutation ¶
Permutation draws an order of 0 … n − 1: the format's permutation, Go's Perm.