Documentation
¶
Overview ¶
Package bench runs cells of virtual learners into a file of results, one line a learner, and reads two such files in pairs by learner. Two versions of one library do not go into one Go build, so each build of sim writes its own file, and the comparison reads them side by side.
Index ¶
- Constants
- Variables
- func CellsOf(populations []string) []string
- func CellsOn(populations []string, packages []published.Package) []string
- func Compare(a, b Side, w io.Writer) error
- func Names(info *debug.BuildInfo, commits map[string]string) (map[string]string, error)
- func Populations(rule run.Rule) []string
- func Run(c Config, w io.Writer) error
- func Write(f *File, w io.Writer) error
- type Cell
- type Config
- type FairCell
- type File
- type GoalCell
- type Header
- type Line
- type Package
- type Part
- type Side
Constants ¶
const Rechosen = 10
Rechosen are the first learners of each cell whose every choice is taken again on the input it keeps, I1, in every run with invariants: the gate's, repeated, and a decisive one alike. Taking each choice again on all the learners would double the engine's work, the most of a run. A repetition holds the bits of every learner, but not that the input a choice keeps is the one it was made on — a rule that changed its input in place would change it alike in both runs —, and the first learners of every cell catch that.
Variables ¶
var ErrBench = errors.New("bench")
ErrBench is a run or a comparison the bench refuses.
var Libraries = []string{"github.com/altnovatrail/learner-model", "github.com/altnovatrail/engine"}
The libraries a file of results names, by module path.
Functions ¶
func CellsOf ¶
CellsOf names the cells of populations, by name: each on every graph it runs on, in order; a name that is no population has none.
func CellsOn ¶
CellsOn names the cells of populations that a run on packages runs: those on the graphs the packages cover; with none, every graph.
func Compare ¶
Compare reads two sides in pairs by learner — the same set, the same cells and the same learners, or none — and writes, for each cell and each number of the measures, a's value, b's, and the difference a − b with its 95 % interval from the same resamples in both, tab-separated; a number a cell cannot read is "-", and a cell on a graph with no published package says so.
func Names ¶
Names gives the version or commit of each library: the version the build took it at — a tag, or a pseudo-version, which holds its commit —, its replacement's, with the replacement's path when it is another module, or the commit the caller names. A library the build took from a workspace has no version, and the caller has to name its commit, a full SHA; a commit named for a library the build names a version of, or for a module that is no library, is refused.
func Populations ¶ added in v0.1.18
Populations names every population a rule runs: under the ceiling of the engine, none of fairness by the grade, since M11 has no path and the ceiling's file stays as it was.
Types ¶
type Cell ¶
Cell is a cell of two sides, its learners in pairs: the n-th of A and of B the same learner, whose number in the cell is the n-th of N.
type Config ¶
type Config struct {
Populations []string
Learners int
Set seed.Set
Rule run.Rule
Commits map[string]string
Part Part
Repeat bool
// Packages take the place of the pinned packages of their modules, and only the graphs whose every
// module is one of them run.
Packages []Package
}
Config is what to run: the populations by name, the learners of each graph, the set and the rule; Commits names a library the build does not, by module path, a full SHA. Part takes a part of the learners, so that a recipe runs the parts as processes of their own and merges their files; Repeat runs each learner twice and holds the two runs to the same bits, I1.
type FairCell ¶ added in v0.1.18
type FairCell struct {
// Cell and Population are the grade's; Reference is the reference's cell, whose name the
// resamples of every grade are drawn by, so that they resample the same n in all the cells.
Cell, Population, Reference string
Graph []string
Pairs []measure.Sums
N []int
}
FairCell is a cell of fairness by the grade read in pairs: the learner n of a grade against the learner n of the reference, one learner under two grades, each pair the sums of M11.
func Fair ¶ added in v0.1.18
Fair reads the cells of fairness by the grade of a file in pairs, each grade's but the reference's, in the order of the file: each against its reference's cell on the same graph, the same learners in the same order, every line with its trace. A file with none gives none.
type File ¶
File is a file of results read back.
func Merge ¶
Merge merges the files of the parts of one run into the file of the whole: the same set, rule, libraries, invariants, populations, learners and repetition, every part of N once, and the lines in the order of the run's populations, their graphs and the learners — the order of a run of the whole.
type GoalCell ¶ added in v0.1.44
type GoalCell struct {
// Cell and Population are the goal's; Twin is its twin's cell; Item the item, as a trace names it.
Cell, Population, Twin, Item string
Graph []string
Pairs []measure.Sums
N []int
}
GoalCell is a cell of the goal for the tutor read in pairs, on one item it sets: the learner n with the goal against the learner n of its twin, the same learner with the empty goal. The resamples are drawn by the twin's cell, so that every cell of the goal resamples the same n.
func Goal ¶ added in v0.1.44
Goal reads the cells of the goal for the tutor of a file in pairs, in the order of the file: the cell of each population that sets a goal and has a twin, on each item it watches, against the twin's cell on the same graph and the same item, the same learners in the same order, every line with its trace. A file with none gives none.
type Header ¶
type Header struct {
Set seed.Set `json:"set"`
Rule string `json:"rule"`
Libraries map[string]string `json:"libraries"`
// Populations, Learners and Repeat are what the run ran, so that the parts of one run merge in its
// order and parts of another run do not; Part is the part of the learners the file holds, the zero
// part all of them.
Populations []string `json:"populations,omitempty"`
Learners int `json:"learners,omitempty"`
Repeat bool `json:"repeat,omitempty"`
Part Part `json:"part,omitzero"`
// Packages are the packages the run took in place of the pinned ones, and it ran only the graphs
// whose every module is one of them: the gate of the CI of modules, on the packages of a pull
// request. None, the pinned packages and every graph.
Packages []published.Package `json:"packages,omitempty"`
// Invariants tells that each line records the breaches of I1–I4 on its run: under the engine.
Invariants bool `json:"invariants"`
}
Header is the first line of a file of results: the set of learners, the rule that chose, and the version or commit of each library the build ran on.
type Line ¶
type Line struct {
Population string `json:"population"`
Graph []string `json:"graph"`
N int `json:"n"`
Sums measure.Sums `json:"sums"`
Oracle measure.Sums `json:"oracle"`
// Breaches are the breaches of the invariants I1–I4 on the run, under the engine; the ceiling of
// the engine is no branch of engine, and its runs are not checked.
Breaches []string `json:"breaches,omitempty"`
// Fair is the trace of M11 of the learner's run, under the engine, in a cell of fairness by the grade
// alone: no other line has it, and theirs stay the bytes they were.
Fair *measure.Trace `json:"fair,omitempty"`
// Goal is the trace of E7 and E8 of the learner's run, in a cell of the goal for the tutor that
// watches an item alone: no other line has it.
Goal *measure.GoalTrace `json:"goal,omitempty"`
}
Line is one learner of a cell: its population, graph and number, and the sums of its run — of the measures of the model and of the engine, and under the engine of the note E6 too — and the oracle's on the same answers.
type Package ¶
Package is a package a run takes in place of the pinned one: what it is, and its module read.