Expand description
The Probl engine: values, distributions and the world-set interpreter. The rules it implements are in docs/semantics.md.
Re-exports§
pub use error::ErrorKind;pub use error::RuntimeError;pub use failure::Failure;pub use failure::Failures;pub use interp::Stats;pub use interp::Updates;pub use symbolic::Diagrams;pub use symbolic::Symbolic;pub use weight::Weight;
Modules§
- analytic
- Identity-preserving continuous outcomes during enumeration.
- builtins
- Built-in functions that don’t need the interpreter.
- chain
- Solving loops as absorbing Markov chains (docs/semantics.md, section 10).
- complex
- Finite complex scalars. These are data, never probability weights.
- conjugate
- Exact updates for conjugate priors (docs/semantics.md, section 14): the probability of an observation when its parameter is unknown, and the parameter’s distribution after it.
- continuous
- Continuous distributions (docs/semantics.md, section 13): densities, CDFs, quantiles and moments, and drawing from them.
- data
- Loading a program’s data (docs/data-input.md).
- dates
- Immutable Gregorian dates, stored as days since 1970-01-01. Public domain: 0001-01-01 through 9999-12-31. No clock is read here.
- dist
- Finite distributions: dice, choices, counts, and the results of computing with them.
- error
- Runtime errors.
- failure
- Worlds that ended at a fault, when the failure mode is partial (docs/semantics.md, section 11).
- interp
- The world-set interpreter.
- joint
- Distributions whose outcomes own continuous draws: what
simulatereturns when its value holds outcomes of draws made inside it (docs/semantics.md, section 8). - likelihood
- Likelihoods of one latent, for
@integrate(docs/semantics.md, section 13): what observations whose parameters are outcomes of the latent say about it, as a weight on its distribution. The latent keeps its distribution and its CDF coordinatesu, and its posterior there has the density w(u) ∝ Π L(x(u)) for x(u) its quantile. Probabilities, quantiles and moments come from integrating w numerically, to a relative tolerance, with a table of its integral shared by every question. - ops
- Operators, and applying operations to every outcome of a distribution.
- quadrature
- Adaptive numerical integration on bounded intervals, for
@integrate(docs/semantics.md, section 13): the 21-point Gauss–Kronrod rule of QUADPACK, bisecting the part with the largest error estimate until the estimate is within the tolerance. An estimate isn’t a bound: a feature narrower than the rule’s nodes can go unseen, which is why callers give the places where the integrand has features as breakpoints. - report
- Collecting
reportvalues across worlds, and printing them (docs/semantics.md, sections 9, 10 and 14). - symbolic
- Experimental: answering finite Boolean programs with decision diagrams instead of worlds (docs/design/symbolic-inference.md, stage 1).
- value
- Runtime values.
- weight
- Weights: non-negative numbers with a binary mantissa and a 64-bit exponent, so products of many small probabilities (long chains of observations) can’t underflow to zero.
- world
- Worlds, and merging the ones that have become identical.
Structs§
- Limits
- Upper bounds set by whoever runs a program. A program’s
@max_worldsand@max_iterationscan lower them, never raise them. - Options
- How the engine runs. The defaults are what
probl runuses, except that the CLI also supplies an execution-date snapshot. - Outcome
- Progress
- A function told how many runs are done, and how many there are.
- Sampled
- How a program was sampled (docs/semantics.md, section 14).
Enums§
- Failure
Mode - What a fault in one world does to the others (docs/semantics.md, section 11). The world that fails always stops there.
- Fault
- A language error that depends on the values a world computes with, not
on the program being wrong: dividing by zero, an index past the end. A
catchcan name one; in partial mode, one that isn’t caught ends only its world (docs/semantics.md, section 11). Errors that aren’t faults always stop the run.
Functions§
- run
- Run a program.
printreceives the output ofprint(…)as it happens. Every problem, including a crash of the engine itself, comes back as an error. - run_
on_ this_ thread - Run a program on the calling thread, as
rundoes on a thread of its own. The calling thread’s stack must be large enough for the program’s calls (Limits::stack_sizedoesn’t apply), and a panic isn’t caught. With one thread allowed (Limits::max_threads), sampling starts no thread either, so this works where threads aren’t available, such as in WebAssembly.