Sampling a quantity from a distribution
sample("x", T, distribution) makes a quantity at an address, scores it by a distribution and returns it, in place of quantity("x", T) followed by the distribution's score, and sample_in does the same for a space given as a value. The core gained the Distribution trait for it, whose one method adds a distribution's term at a quantity, with an implementation for references so that a distribution is passed by value or borrowed; Normal implements it by its own score, which stays, so that a caller scoring by a normal it names imports nothing. A refusal by either step is recorded at the line that called sample. It returns the quantity and not the term: the term is found from the quantity, which is scored at most once, and a model that needs the term's handle writes the two statements. The sugar adds no mathematics: sample builds exactly what those two statements build.
sample("x", T, distribution) makes a quantity at an address, scores it by a distribution and
returns it, in place of quantity("x", T) followed by the distribution’s score, and sample_in does the same for a space given as a value. The core gained the Distribution trait for it, whose
one method adds a distribution’s term at a quantity, with an implementation for references so that
a distribution is passed by value or borrowed; Normal implements it by its own score, which
stays, so that a caller scoring by a normal it names imports nothing. A refusal by either step is
recorded at the line that called sample. It returns the quantity and not the term: the term is
found from the quantity, which is scored at most once, and a model that needs the term’s handle
writes the two statements. The sugar adds no mathematics: sample builds exactly what those two
statements build.
The guide’s first page was rewritten top-down around it. It opens on a hierarchical normal, a point
of the plane and its squared range, written with sample, generated from the joint and queried
with the range observed for its density and gradient; and only then goes down to programs of plain
arithmetic, to the same model written with quantity and score, and to terms written by hand
beside likelihood factors. The umbrella crate’s tests hold that model, so that the guide quotes
what a user writes.
Where it stands
- Plan
- Build
- Publish
Documents
What it changed
The pages that say what this entry made true:
- Building a model A model is built inside a scope a writer opens, by ordinary functions of handles, and published as an immutable snapshot that may be read from any thread or forked into a branch.
- Terms and the probabilistic graph A model's density is a sum of terms, each a log-density that scores one quantity or none; the terms and quantities together make the probabilistic graph inference reads, and a retirement removes some quantities, replaces their terms, and frees what it leaves needed by nothing.
- The normal distribution skoro's normal is the law of a point moved by normal noise through its space's chart, on every space whose chart is global, with an exact density and sampler, a scale in four forms, roles that estimators read, its tangent among them, and the Gaussian and improper Gaussian replacements of a retirement.
- A first model Write a hierarchical normal with `sample`, generate from it and take its density and gradient given an observation, then see what the sugar is made of, from the tests of skoro itself.
- Crates The workspace's crates, what each holds, and what each depends on.
The crates it changed:
What it revises
- Normal distributions Done skoro's first distribution, the normal, returns as one distribution for every space whose chart is global and whose volume is known: the law of the mean moved by normal noise through its chart, so…
History
- Started at plan
- Approved plan
fc450e0 - Approved build
92713ad - Reopened plan
b14029fThe guide's restructure needs tests that build a hierarchical normal with sample, and the same model with quantity and score. - Approved plan
a20cfc6 - Approved build
353ef48 - Approved publish
988614f