Skip to main content

Module analytic

Module analytic 

Source
Expand description

Identity-preserving continuous outcomes during enumeration.

An outcome is a function of one axis: a latent variable, or a linear form of independent normal latents, as x + y is. It’s affine on each of a few pieces of the axis’s CDF coordinates, which keeps abs, min, max and clamp exact. Evidence is a set of intervals in a latent’s coordinates, and an event a union of boxes of independent axes’ ones. Worlds own their restrictions, and the latent’s distribution there: a posterior after an exact update. An observation of several normal latents together makes each the linear form of fresh independent ones, which carries their correlation. A value carries the coordinates of the distribution it was made under, and moves to the world’s when it’s read. Values and closures remain immutable, and calls return restrictions alongside their results.

Structs§

Affine
scale * x + offset, for the latent x.
Analytic
Domain
Sorted, disjoint CDF intervals. Endpoints have zero probability.
Event
Where independent axes are: a union of disjoint boxes, each a domain of each axis in its CDF coordinates.
Fun
The function an outcome is of the draw on a piece of it: outer, of kernel, of inner, of the draw’s value. Monotone on its piece. An affine one has the identity kernel and inner function, so that outer is all of it.
Latent
What a world knows about a latent: its distribution, and where it can be, in that distribution’s CDF coordinates. After an observation of several normal latents together, also the linear form of fresh ones that it is now: its distribution is then that form’s, and it’s unrestricted.
Linear
constant + Σ coef × latent over independent normal latents, by increasing id, none with a zero coefficient.
Term
One of the independent normal latents of a linear form: its id, its coefficient, and its distribution where the form was made.

Enums§

Kernel
A monotone function of a number, between two affine ones in a piece’s function.
Rounding
How floor, ceil, trunc and round make an int of a number.

Functions§

abs
binary
clamp
clamp(x, lo, hi) with numbers for bounds, which the caller has checked are in order. It’s an int if x and the bounds are.
collect_form_ids
Adds the latents that the forms of those in ids are made of, which the world must keep knowing about too.
collect_ids
Latents reachable through an immutable value (including closure captures).
contains
Scan through aggregate values too: symbolic numbers must never become categorical keys or be compared by their internal identity as user data.
extreme
min or max of numbers and outcomes of one draw. As with numbers, each argument replaces the best so far where it’s strictly better.
has_outcomes
Whether a value holds an outcome of a draw, other than events.
joint_condition
Restricting worlds by an outcome of several normal draws together would make them a truncated joint distribution.
logic
marginal
A value as reports keep it: each outcome of a draw by its marginal alone, without the identity of its draws, so that equal laws merge.
negate
normal_draw
A draw from normal(mean, sd), with mean an outcome of normal draws: the mean plus a fresh normal latent id with standard deviation sd. None if the mean isn’t an unrestricted linear form of normal draws.
observe_normal
Observing y from normal(mean, sd), with mean an outcome of normal draws: the logarithm of its density, and what the world knows about each latent after it. None if the mean isn’t affine in a normal latent or a linear form of several.
outside
Where an outcome of a draw, by its pieces, is outside the range from lo to hi, in the draw’s coordinates within its domain. Each bound is included when its flag is.
renamed
The same value with its latents renamed by map.
resolve
Snapshot a value under this world’s posterior without mutating aliases.
rounded
floor(x), ceil(x), trunc(x) or round(x): an int that is constant on each part of the draw where x is between two of the rounding’s steps, with that part’s probability. Where x is constant, it rounds as a number does, ties included; elsewhere a step has no probability.
transformed
sqrt, exp or ln of an outcome of a draw. Where the outcome is outside what the function is defined for, with positive probability, it faults there: everywhere is a fault, as for a number; part of the domain isn’t supported yet.
unsupported
update
An exact update of a draw x, read in the world it’s updated in, from observing seen with x itself as the parameter: the logarithm of the observation’s probability (a density for a normal), and what the world knows about the draw after it. None if the draw’s distribution isn’t the prior of a conjugate pair with this observation.

Type Aliases§

Constraints
Observed
An observation’s log density, and what the world knows about each latent after it.
Pieces
A function of a latent, by where each of its pieces ends in the latent’s CDF coordinates: the first starts at 0, each other where the one before it ends, and the last ends at 1.