bench

package
v0.1.44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

View Source
var ErrBench = errors.New("bench")

ErrBench is a run or a comparison the bench refuses.

View Source
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

func CellsOf(populations []string) []string

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

func CellsOn(populations []string, packages []published.Package) []string

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

func Compare(a, b Side, w io.Writer) error

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

func Names(info *debug.BuildInfo, commits map[string]string) (map[string]string, error)

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

func Populations(rule run.Rule) []string

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.

func Run

func Run(c Config, w io.Writer) error

Run runs the cells of a config, every graph of every population — with packages in place of the pinned ones, the graphs they cover —, and writes the file of results to w: the header, then one line a learner of its part, in the order of the populations, their graphs and the learners.

func Write

func Write(f *File, w io.Writer) error

Write writes a file of results: its header, then a line a learner.

Types

type Cell

type Cell struct {
	Cell, Population string
	Graph            []string
	A, B             []measure.Sums
	N                []int
}

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.

func Cells

func Cells(a, b Side) ([]Cell, error)

Cells reads two sides in pairs by learner: the same set, the same cells and the same learners in the same order, or none. Against the ceiling of the engine, which does not run the populations of fairness by the grade, their lines are left out of both sides.

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

func Fair(f *File) ([]FairCell, error)

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

type File struct {
	Header Header
	Lines  []Line
}

File is a file of results read back.

func Merge

func Merge(parts []*File) (*File, error)

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.

func Read

func Read(r io.Reader) (*File, error)

Read reads a file of results.

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

func Goal(f *File) ([]GoalCell, error)

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 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

type Package struct {
	published.Package
	Module *pack.Module
}

Package is a package a run takes in place of the pinned one: what it is, and its module read.

type Part

type Part struct {
	K int `json:"k"`
	N int `json:"n"`
}

Part is the K-th of N parts of the learners: those whose number n gives K by n mod N. The zero part is the whole. The bench draws a learner from its seeds alone, so a learner is the same in any part, and the parts run as processes, not goroutines.

type Side

type Side struct {
	File   *File
	Oracle bool
}

Side is one side of a comparison: a file of results, and whether it is read as its rule's sums or as the oracle's.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL