skoro v0.0.0

Mathematics

The improper Gaussian factor, a sum of squared affine rows of any number, a linear term and a constant in the stacked tangent of a retirement's blanket at constant anchors, which keeps what retired terms say about blanket quantities they do not determine, adds across retirements, and is the normal's Stacked replacement when it is of full rank.

Updated 2026-11-14 · 15 min read

The problem#

A retirement removes quantities from a model and keeps what they said about the rest in a replacement: a likelihood factor over the Markov blanket of the retired terms, the integral of those terms over the retired quantities. The normal writes that replacement in one form, its Stacked replacement (the normal as a likelihood factor), a normal density of the blanket’s tangent coordinates at fixed anchors. A normal density has a covariance, so Stacked can only write a replacement that determines every direction of the blanket.

Many retirements do not. A landmark seen by bearing from a single pose is the standard case. When the pose is retired, the bearing has said in which direction the landmark lies, and nothing about how far. In the landmark’s tangent coordinates, the replacement is then Gaussian across the bearing and constant along it, and no covariance describes it. A filter that must write its replacement as a normal density has two bad choices: refuse the retirement, or invent a depth. The first keeps the pose in the model until the landmark is seen again, so that the window grows. The second puts a prior on the landmark that the data never gave.

The archive’s sliding windows wrote their replacement as a joint normal in the offset form W(xB⊖x^B)−dW (\point_B \ominus \hat \point_B) - d, anchored at the point where it was computed so that its value and Jacobian there are exactly the eliminated rows, with a triangular WW of full rank. The anchoring carries over unchanged; the rank does not.

This entry gives skoro a form that needs neither a refusal nor an invented depth: the improper Gaussian factor, a sum of squared affine rows of any number, a linear term and a constant, in the blanket’s tangent coordinates at fixed anchors. It keeps exactly what the retired terms say and nothing more. Such factors add, so that a model can marginalize what it learns about a quantity it cannot yet estimate, accumulate it over several retirements, and estimate the quantity once enough is known. When the factor determines its blanket, it is a normal, and its value is the Stacked replacement’s.

The entry provides the factor, the forms in which it can be written, and the roles it binds. Computing a factor from a linearized retirement is the work of the linearization entry, which needs it. This document works out what the factor is, when it is a normal, which of its forms are the same function, how factors accumulate, and what a reader of its roles may assume.

Setting#

Retirement. A retirement retires the quantities EE, of which EOE_O are fixed at given values and EFE_F are integrated out, and replaces the terms TE\mathcal T_E joined to them by a likelihood factor ℓB\logterm_B over their Markov blanket BB (22), the integral of Proposition 23. The core checks that the factor is reached from no quantity outside BB, and applies the change. After it, a blanket quantity whose scoring term was retired is scored by no term, and so is a parameter, of which exp⁡ℓB\exp \logterm_B is a score, as a score is conditioned on a parameter with an improper prior (parameters and improper priors). Generation draws such a quantity from a proposal given with the replacement, and is refused for it otherwise. A retirement’s replacement may bind roles, which the retirement binds to the factor it adds (the replacement’s bindings).

The stacked tangent. For continuous blanket quantities BF=(x1,…,xk)B_F = (\point_1, \dots, \point_k) and an anchor pip_i for each, a constant of its type, the normal’s stacked tangent is

δ(xB)=(x1⊖p1,…,xk⊖pk)∈RD,D=∑idi, \delta(\point_B) = (\point_1 \ominus p_1, \dots, \point_k \ominus p_k) \in \R^D , \qquad D = \sum_i \dimension_i ,

(9), the blocks stacked as columns, as every tuple in this document is. It is defined where each xi\point_i lies in the chart’s image at pip_i, which for a full chart is all of the type but a set of measure zero. On a flat-in-disguise type, a Euclidean or a positive one, it translates exactly with the anchor, (1). The anchors are constants, so that a factor written in δ\delta does not move with the quantities it summarizes.

Stacked. The normal’s replacement is ℓN(δ; m,W)+c\logterm_{\mathcal N}(\delta;\, m, W) + c (10): the normal’s term on RD\R^D, where the log-volume vanishes, at the value δ\delta, with a mean mm, a whitening WW of full rank and a constant cc. It binds the whitened residual W(δ−m)W(\delta - m), the mean and the scale.

What a reader of a residual assumes. The normal’s roles let a reader of the whitened residual rr assume that the rest of the term’s log-density is a normalizer constant in the free quantities and, where one is bound, a log-volume λ\lambda, a node of its own (the normal’s roles):

ℓ=−12∣r∣2+n−λ.(1) \logterm = -\tfrac12 \lvert r \rvert^2 + n - \lambda . \tag{1}
(1)

A least-squares reader adds the bound log-volume’s gradient to the residuals’ to find the term’s own stationary points. The factor of this entry is written so that it keeps this contract.

The improper Gaussian factor#

Definition 2(The improper Gaussian factor).

Let BF=(x1,…,xk)B_F = (\point_1, \dots, \point_k) be continuous quantities, with anchors pip_i constants of their types and δ(xB)∈RD\delta(\point_B) \in \R^D the stacked tangent (9). Given a matrix A∈Rr×DA \in \R^{r \times D}, for any number r≥0r \ge 0 of rows, a vector b∈Rrb \in \R^r, a vector η∈RD\eta \in \R^D and a constant cc, the improper Gaussian factor is the likelihood factor

ℓ(xB)=−12∣A δ(xB)−b∣2−η⊤δ(xB)+c. \logterm(\point_B) = -\tfrac12 \bigl\lvert A\, \delta(\point_B) - b \bigr\rvert^2 - \eta\transpose \delta(\point_B) + c .

Its whitened residual is Aδ−bA \delta - b, of rr components, and its linear part is η⊤δ\eta\transpose \delta.

The rows say what the factor determines. Write δ=δ∥+δ⊥\delta = \delta_\parallel + \delta_\perp, with δ∥\delta_\parallel in the row space of AA and δ⊥\delta_\perp in its null space. Along the row space the squares are a Gaussian. Along the null space the squares do not change, and the factor is linear, with slope −η⊤δ⊥-\eta\transpose \delta_\perp. A factor with r=0r = 0 rows is linear and a constant alone.

Proposition 3(A factor of full rank is a normal).

As a function of δ∈RD\delta \in \R^D, eℓe^{\logterm} is integrable if and only if AA has rank DD. When it has, let WW be the lower-triangular matrix with a positive diagonal and W⊤W=A⊤AW\transpose W = A\transpose A, and

m=(A⊤A)−1(A⊤b−η),cN=c+12∣Wm∣2−12∣b∣2−∑ilog⁡Wii+D2log⁡2π. m = (A\transpose A)^{-1} (A\transpose b - \eta) , \qquad c_{\mathcal N} = c + \tfrac12 \lvert W m \rvert^2 - \tfrac12 \lvert b \rvert^2 - \sum_i \log W_{ii} + \tfrac{D}{2} \log 2\pi .

Then ℓ(xB)=ℓN(δ(xB); m,W)+cN\logterm(\point_B) = \logterm_{\mathcal N}\bigl(\delta(\point_B);\, m, W\bigr) + c_{\mathcal N}: the factor is the normal’s Stacked replacement (10) with the mean mm, the whitening WW and the constant cNc_{\mathcal N}.

Proof.

If AA has rank less than DD, take n≠0n \ne 0 with An=0A n = 0. Along the line δ+tn\delta + t n the factor is ℓ(δ)−t η⊤n\logterm(\delta) - t\, \eta\transpose n, so eℓe^{\logterm} is constant or grows exponentially along every such line, and the integral over RD\R^D diverges. If AA has rank DD, Λ=A⊤A=W⊤W\Lambda = A\transpose A = W\transpose W is positive definite, and

−12∣Aδ−b∣2−η⊤δ=−12δ⊤Λδ+δ⊤(A⊤b−η)−12∣b∣2=−12∣W(δ−m)∣2+12∣Wm∣2−12∣b∣2, \begin{aligned} -\tfrac12 \lvert A \delta - b \rvert^2 - \eta\transpose \delta &= -\tfrac12 \delta\transpose \Lambda \delta + \delta\transpose (A\transpose b - \eta) - \tfrac12 \lvert b \rvert^2 \\ &= -\tfrac12 \lvert W (\delta - m) \rvert^2 + \tfrac12 \lvert W m \rvert^2 - \tfrac12 \lvert b \rvert^2 , \end{aligned}

since Λm=A⊤b−η\Lambda m = A\transpose b - \eta. The first term is ℓN(δ; m,W)−∑ilog⁡Wii+D2log⁡2π\logterm_{\mathcal N}(\delta;\, m, W) - \sum_i \log W_{ii} + \tfrac{D}{2} \log 2\pi, which is integrable, and adding cc gives cNc_{\mathcal N}.

∎

So the improper Gaussian factor contains Stacked as its case of full rank, and adds every factor that Stacked cannot write. Integrability in δ\delta is the only difference, and a likelihood factor never needed it: Proposition 23 asks of a replacement that it be a function of the blanket, which an improper factor is. Integrability in δ\delta is not integrability against the blanket’s reference measure, which carries the chart’s volume eλe^{\lambda}: on a compact curved type such as the rotations, a bounded factor of any rank is integrable against the type’s measure, and on a positive type the two differ by the factor x\point. What matters below is the reading in δ\delta, where the factor is Gaussian or flat.

What integrability does change is generation. A blanket quantity that becomes a parameter with an improper factor as its only score is not drawn from the factor. It needs a proposal, as the core already asks of every parameter, and generation is refused for it without one. Where the factor determines a Euclidean blanket, drawing δ\delta from the normal of Proposition 3 and setting xi=pi⊕δi\point_i = p_i \oplus \delta_i is a proposal that makes every draw’s weight the same, as the Kalman prediction does for the core’s replacement of full rank. On a positive or a curved type the draw has the density of that normal times e−λe^{-\lambda} with respect to the type’s measure, and the weights then vary with the chart’s volume.

Two examples#

A bearing in the plane. Take a landmark ℓ∈R2\ell \in \R^2 and poses xk∈R2\point_k \in \R^2, each with its own prior N(pk,Pk)\mathcal N(p_k, P_k), and a measurement of each pose along a known unit direction aka_k,

zk=ak⊤(ℓ−xk)+εk,εk∼N(0,σ2), z_k = a_k\transpose (\ell - \point_k) + \varepsilon_k , \qquad \varepsilon_k \sim \mathcal N(0, \sigma^2) ,

a linear stand-in for a bearing, which measures the landmark’s offset from the pose across one direction only. Retire xk\point_k, with zkz_k observed at z^k\hat z_k. Integrating the pose out, ak⊤ℓ−zka_k\transpose \ell - z_k is normal with mean ak⊤pka_k\transpose p_k and variance sk2=σ2+ak⊤Pkaks_k^2 = \sigma^2 + a_k\transpose P_k a_k, so that, with the anchor qq for ℓ\ell and δ=ℓ−q\delta = \ell - q,

ℓk(ℓ)=−12sk2(ak⊤δ−(z^k+ak⊤pk−ak⊤q))2−12log⁡(2πsk2). \logterm_k(\ell) = -\frac{1}{2 s_k^2} \bigl(a_k\transpose \delta - (\hat z_k + a_k\transpose p_k - a_k\transpose q)\bigr)^2 - \tfrac12 \log (2\pi s_k^2) .

This is the factor with one row, A=ak⊤/skA = a_k\transpose / s_k, b=(z^k+ak⊤pk−ak⊤q)/skb = (\hat z_k + a_k\transpose p_k - a_k\transpose q) / s_k, η=0\eta = 0 and c=−12log⁡(2πsk2)c = -\tfrac12 \log (2\pi s_k^2), exactly. It has rank one on R2\R^2 and is constant along the direction orthogonal to aka_k: the line on which the measurement places the landmark. Retiring a second pose with a direction ak′a_{k'} not parallel to aka_k gives a second such factor. Their sum has two rows of rank two, and is by Proposition 3 a normal, whose mean is the point at which the two lines cross. It is the replacement that retiring both poses at once would give, since their retired terms are disjoint and the joint integral is the product of the two.

A positive quantity. Let a positive quantity x\point be scored by the normal on the positive type with the mean eθ+φe^{\theta + \varphi} and the scale σ\sigma, where θ∼N(0,1)\theta \sim \mathcal N(0, 1) is Euclidean, and retire θ\theta, keeping φ\varphi and x\point. The normal’s term on the positive type is the Gaussian of log⁡x\log \point less the log-volume log⁡x\log \point ((3)), so

ℓB(φ,x)=log⁡∫N(θ; 0,1) 1x N(log⁡x; θ+φ,σ2) dθ=−log⁡x−(log⁡x−φ)22s2−12log⁡(2πs2), \logterm_B(\varphi, \point) = \log \int \mathcal N(\theta;\, 0, 1)\, \frac{1}{\point}\, \mathcal N(\log \point;\, \theta + \varphi, \sigma^2) \, \dd \theta = -\log \point - \frac{(\log \point - \varphi)^2}{2 s^2} - \tfrac12 \log (2\pi s^2) ,

with s2=1+σ2s^2 = 1 + \sigma^2. In the stacked tangent at the anchors (φ^,x^)(\hat \varphi, \hat \point), δ=(φ−φ^, log⁡x−log⁡x^)\delta = (\varphi - \hat \varphi,\, \log \point - \log \hat \point), it is the factor with

A=1s[−11],b=−log⁡x^−φ^s,η=(0,1),c=−log⁡x^−12log⁡(2πs2). A = \tfrac{1}{s} \begin{bmatrix} -1 & 1 \end{bmatrix} , \qquad b = -\frac{\log \hat \point - \hat \varphi}{s} , \qquad \eta = (0, 1) , \qquad c = -\log \hat \point - \tfrac12 \log (2\pi s^2) .

The linear term is not in the row space of AA: by part 3 of Lemma 4, at most its projection onto that space, (−12,12)(-\tfrac12, \tfrac12), can be moved into bb, and (12,12)(\tfrac12, \tfrac12) remains. Along the null direction (1,1)(1, 1), the factor falls linearly. A replacement computed by linearizing normals on the Euclidean and the curved types has no such term, since the normal’s log-volume there is a function of its tangent coordinate alone and its gradient lies in the span of its own rows; the linearization entry shows it. On the positive types one remains, as here, which is why the factor carries η\eta.

Forms of one factor#

Lemma 4(Forms of one factor).

Each of the following changes (A,b,η,c)(A, b, \eta, c) and leaves the value of the factor unchanged at every xB\point_B:

  1. for an orthogonal Q∈Rr×rQ \in \R^{r \times r}, (Q⊤A, Q⊤b, η, c)(Q\transpose A,\, Q\transpose b,\, \eta,\, c);
  2. if [A   b]=[A′b′0e][A \;\, b] = \begin{bmatrix} A' & b' \\ 0 & e \end{bmatrix}, with zero rows in AA below A′A', (A′, b′, η, c−12∣e∣2)(A',\, b',\, \eta,\, c - \tfrac12 \lvert e \rvert^2);
  3. for any u∈Rru \in \R^r, (A, b−u, η−A⊤u, c−u⊤b+12∣u∣2)(A,\, b - u,\, \eta - A\transpose u,\, c - u\transpose b + \tfrac12 \lvert u \rvert^2).

Moving the anchor pip_i of each quantity xi\point_i of a flat-in-disguise type to pi′=pi⊕wip_i' = p_i \oplus w_i, and keeping the anchors of the others, with w∈RDw \in \R^D stacked from the wiw_i and zero in the blocks of the anchors kept, also leaves it unchanged with (A, b−Aw, η, c−η⊤w)(A,\, b - A w,\, \eta,\, c - \eta\transpose w).

Proof.

For part 1, ∣Q⊤(Aδ−b)∣=∣Aδ−b∣\lvert Q\transpose (A \delta - b) \rvert = \lvert A \delta - b \rvert. For part 2, the squares of the zero rows are ∣0⋅δ−e∣2=∣e∣2\lvert 0 \cdot \delta - e \rvert^2 = \lvert e \rvert^2. For part 3, expanding the square,

−12∣Aδ−(b−u)∣2−(η−A⊤u)⊤δ=−12∣Aδ−b∣2−u⊤(Aδ−b)−12∣u∣2−η⊤δ+u⊤Aδ=−12∣Aδ−b∣2−η⊤δ+u⊤b−12∣u∣2, \begin{aligned} -\tfrac12 \lvert A \delta - (b - u) \rvert^2 - (\eta - A\transpose u)\transpose \delta &= -\tfrac12 \lvert A \delta - b \rvert^2 - u\transpose (A \delta - b) - \tfrac12 \lvert u \rvert^2 - \eta\transpose \delta + u\transpose A \delta \\ &= -\tfrac12 \lvert A \delta - b \rvert^2 - \eta\transpose \delta + u\transpose b - \tfrac12 \lvert u \rvert^2 , \end{aligned}

and the new constant restores cc. For the anchors, xi⊖pi′=(xi⊖pi)−wi\point_i \ominus p_i' = (\point_i \ominus p_i) - w_i by (1), and the blocks of the anchors kept are unchanged, so δ=δ′+w\delta = \delta' + w in the new stacked tangent δ′\delta', and substituting gives the new right-hand side and constant.

∎

Parts 1 and 2 together are an orthogonal factorization of [A   b][A \;\, b]. It leaves at most DD rows, so a factor never needs more rows than its blanket has coordinates. Part 3 moves any part of η\eta that lies in the row space into bb. Choosing uu to minimize ∣η−A⊤u∣\lvert \eta - A\transpose u \rvert leaves only the part of η\eta in the null space, which no form removes. When AA has rank DD, that part is zero, and the form is the normal’s of Proposition 3.

None of these changes the value, so a factor is the function it is, whichever form it is given in. The factor is kept in the form it is given, and no form is chosen for it by looking at its numbers. A batch of models has one factor for every row, with numbers of its own, and a form chosen by rank would give different rows different shapes. The number of rows rr, and whether η\eta is present, are therefore set by whoever writes the factor, and are the same for every row of a batch. A reduction by parts 1 and 2 to min⁡(r,D)\min(r, D) rows depends on the shapes alone, and is safe to apply to every row.

Accumulation#

Factors over the same quantities add. Two factors over blankets B1B_1 and B2B_2, with the same anchor for each quantity they share, sum to a factor over B1∪B2B_1 \cup B_2, whose rows are the two sets of rows, each with zero columns for the quantities it does not involve, whose linear term is the sum of the two, each extended by zeros, and whose constant is the sum. The sum’s value is the sum of the values, at every point, by the definition alone. Its rows can then be reduced by Lemma 4 to at most DD, and once they have rank DD it is a normal.

The model does not need its factors summed: a model that holds several factors is their sum, and every reader of the model reads them as terms. Summing is a convenience, which keeps a model of many retirements small. It is exact when the anchors agree, and whatever the anchors of the flat-in-disguise quantities, since the last part of Lemma 4 moves those anchors without changing the factor’s value. On a curved type, the stacked tangent at one anchor is not an affine function of the stacked tangent at another, and two factors anchored differently are kept as two terms.

The example of the bearings shows what this buys. A filter retires each pose as it leaves the window, and each retirement leaves one row on the landmark. The landmark is undetermined until two rows of different directions have accumulated. Until then, a query that leaves it free, with nothing else to determine it, has no unique answer, and an estimator that needs one refuses it. After that, it is estimated, and nothing was lost on the way.

Derivatives#

The factor is a function of the blanket’s quantities through δ\delta, and its derivatives are those of its two parts. In the chart at xi\point_i, the block of δ\delta for xi\point_i has the derivative D(xi⊖pi)\D(\point_i \ominus p_i), which is the identity at xi=pi\point_i = p_i and everywhere on a flat-in-disguise type, and on a curved type moves with xi\point_i as the core’s inverse retraction does. So the residual Aδ−bA \delta - b has the Jacobian A DδA\, \D \delta, and the linear part has the gradient Dδ⊤η\D \delta\transpose \eta.

On the flat-in-disguise types, δ\delta is affine in every chart of the blanket, so the factor is exactly quadratic in it. Its residual’s Jacobian is constant, its Gauss–Newton matrix Dδ⊤A⊤A Dδ\D \delta\transpose A\transpose A\, \D \delta is its exact negative Hessian, and the linear part has no curvature. On a curved type the factor has the curvature that δ\delta has, as a Stacked replacement does: it vanishes at the anchors and is of first order in δ\delta near them.

The roles#

The factor keeps the contract (1) of a term that binds a residual:

  • its whitened residual is Aδ−bA \delta - b, with rr components, none included;
  • its normalizer is the constant cc;
  • its log-volume, where η\eta is present, is its linear part η⊤δ\eta\transpose \delta, the varying part of its remainder, the part that (1) calls λ\lambda.

A least-squares reader that reads the residual and adds the gradient of the bound log-volume therefore finds the factor’s own gradient, and a reader that reads only the residual finds the gradient of its squares. That is what such a reader finds on the normal’s terms, where the bound node is a log-volume indeed. The factor binds no mean and no scale. Where it is not of full rank it has neither, and where it is, they can be computed from it by Proposition 3. It binds no information root, since it is a likelihood factor and scores no quantity, as the normal says of its own likelihood factors. A residual of no components is a residual: a reader that requires every factor to bind a residual accepts such a factor, whose remainder is then all it says.

In skoro’s terms#

  • The factor is a likelihood factor over continuous blanket quantities, scoring none of them, added by a retirement as its replacement, or by a model directly. It is reached only from the blanket’s quantities, through δ\delta, so the core’s check of a replacement holds.
  • Its constants are the anchors, constants of the quantities’ types, and AA, bb, η\eta and cc, constants of the model. In a batch, their numbers may differ from row to row, while the number of rows rr, the blanket’s dimension DD, and whether η\eta is present are one for every row.
  • Its value is Definition 2. Its derivatives are those of δ\delta, composed with AA and η\eta, of the order of the blanket’s inverse retractions.
  • It is a normal when it is of full rank, with the mean, the whitening and the constant of Proposition 3. The normal’s Stacked replacement stays the form for a caller that has a mean and a scale. The improper factor is the form for one that has rows.
  • Its forms are those of Lemma 4. A factor keeps the one it is given. A reduction to min⁡(r,D)\min(r, D) rows is a change of form the library may apply, since it depends on the shapes alone; it applies no other.
  • Several factors over the same quantities are held as several terms, which every reader of the model reads as their sum. Summing them into one is exact at common anchors and on the flat-in-disguise types at any anchors, and is left to a later entry.
  • Its roles are the whitened residual Aδ−bA \delta - b and, where η\eta is present, the log-volume role, bound to the linear part η⊤δ\eta\transpose \delta, which a reader takes as the varying part of the remainder and not as the volume of a chart.
  • A blanket quantity it leaves undetermined becomes a parameter that it cannot generate: the caller gives a proposal, or generation is refused for it, as the core does for every parameter.

Open questions#

None remain. Which role binds the linear part is settled in The roles, and whether the library sums factors in Accumulation.

Revisions#

2026-11-09. In In skoro’s terms, the sentence saying that a reduction to min⁡(r,D)\min(r, D) rows “is the only one the library applies by itself” read as a promise that the library applies one, which the implementation does not. It now says that the library may apply that reduction, since it depends on the shapes alone, and applies no other change of form.

Built on by