Mathematics
The uniform distribution on a type of finite mass, curved or finite and discrete, its constant term and its sampler; and what a normal with a large scale is on a curved type, with the ways of refusing it, bounding its scale, replacing its law and documenting it weighed against each other.
The problem#
A model often has to say that nothing is known of a rotation or a direction before the data are seen: the heading of a robot at start-up, the attitude of a camera, the first pose of a graph. On a Euclidean type the habit is a normal with a very large standard deviation, and the habit carries over to curved types unexamined. There it says something else. The normal of a curved type is the law of its mean moved by Gaussian noise through a global chart, and under the Cayley chart that the rotations now have a large tangent vector is a turn of nearly : the larger the scale, the more surely the draw is a half-turn from the mean, where the chart is cut and a term is not finite.
Two things are worked out here. The first is the distribution that does say “unknown”, the uniform distribution on a type whose reference measure is finite: its term, its sampler, and what an estimator reads of it. The second is what to do about a normal with a large scale on a curved type, whether its scale is a constant someone wrote or a random quantity that is large with small probability. Four ways are weighed: refusing it, bounding the scale by a saturating function, replacing the normal’s law by one that tends to the uniform, and documenting it.
The general mathematics is in the note on the uniform distribution, written with this entry. What follows is skoro’s own: which types, which choices, and why.
Setting#
A continuous type has, or declares, a reference measure and the log-volume of its chart (the measures). The types at issue are those of finite mass :
- the rotations
Rotation, stored as unit quaternions up to their sign, with the Cayley chart, global and full, and Haar measure of mass ; - the core’s two test spheres, with surface measure of mass , one with the stereographic chart, global and full, and one with the exponential chart, full and not global;
- products of these, with the product of their masses;
- the finite discrete types of the core, among them, with counting measure of mass .
The rigid motions Pose and the extended poses ExtendedPose have translations and so infinite
mass, as have the Euclidean and positive types, and the integers under counting measure. The masses are those of the note’s table.
The normal is that of its note, with the log-density (1), the whitening and the precision . An isotropic scale is , and on a curved type is in the coordinates of the chart, which are radians to first order.
The uniform distribution#
On a type of finite mass the uniform distribution is the law , with the log-density (1),
which is on the rotations, on a sphere, on , and on a product the sum of its factors’. It has no parameters, and it is defined by the measure alone: unlike the normal it asks nothing of the chart, so the exponential test sphere, on which the normal is refused, has a uniform distribution like any other type of finite mass.
The mass is declared. A type declares its log-volume because computing it would cost derivatives the core does not have (Declared, not computed). The mass is a number, the integral of that volume over the chart’s domain, (8), and that identity is already among the checks of a declared volume, where the test supplies the mass. The type now declares it, , and the same check compares the declaration with the integral. A type that declares no mass has no uniform distribution, and a product has one when every factor has. A categorical type declares nothing: its mass is its number of values, which is the type itself.
What the term is. The term (1) is a constant, so its gradient and its Hessian product vanish in every chart, and it changes neither a mode nor a step towards one. It is not nothing: it is the term that makes the model’s density a density, and it enters the evidence and every importance weight, where a model with a uniform prior and one with a normal prior are compared at their true normalizations. As a proposal, the uniform distribution has the same constant density, and its weight is the model’s density times the mass.
On a discrete type. The uniform distribution on is the probability mass at every value, and it is skoro’s first distribution on a discrete type. Nothing in it is new to the core, which already states every density of a discrete quantity against counting measure and never differentiates with respect to one (discrete quantities). What it brings is a prior for the index of a selection (12): a quantity that is one of values with equal probability, a mixture of equal weights once the index is summed or sampled over. A distribution of unequal weights is another law, with a parameter, and is not part of this entry.
The uniform among the normals. By Proposition 2, a uniform rotation is at any , with a Cauchy vector of scale in the Cayley chart, and so, by (3), a mixture of the normals over the scale , with standard normal. “Unknown” is therefore not a normal with one large scale. It is the normals of every scale together, most of them broad, with weights that only the chart’s volume could have named.
Drawing a uniform point#
The normal’s sampler draws on the host, in double precision, from uniform variates of the row’s key, and its draw is a fixed function of them (the normal’s sampler). The uniform distribution has two samplers of the same kind.
Through the chart. Draw the tangent vector of Proposition 2 and retract a fixed point by it: on the rotations, from four normal variates. It needs only the type’s retraction and a sampler of the tangent law, but that law is the type’s own (a Cauchy for one chart, a Student t of two or three degrees of freedom for others), it spends a variate more than the dimension or inverts a distribution function with no closed form, and its largest draws are retracted where the chart is steepest.
Directly. A map from the unit cube of variates into storage that carries Lebesgue measure to the uniform distribution: Proposition 4 gives one for and one for the rotations,
a unit quaternion of a uniform rotation, in whichever order storage keeps its parts, since the uniform distribution on is invariant under a permutation of coordinates. Its sign is immaterial to a type stored up to it.
A discrete type has no dimension, and its draw spends one variate,
The variates of a key are the midpoints of a grid on , so each value is drawn with a probability within of , and exactly when is a power of two. The product is taken so that its rounding cannot return .
A normal with a large scale#
Proposition 5 says what the habit of a large scale does on a compact type with a global chart: as the scale grows, the normal’s mass leaves every compact part of the chart’s image, its total variation distance from the uniform distribution tends to , and its limit sits on the chart’s cut. On the rotations with an isotropic scale the limit is the mean turned by a half-turn about a uniform axis. The median angle between a draw and the mean, computed from the chart, is
| uniform | |||||||
|---|---|---|---|---|---|---|---|
| median angle, rad |
These replace the figures the normal’s entry was evaluated with, which were drawn under the stereographic chart of the quaternions, where a broad normal returned to its mean on the far side of the sphere. Under the Cayley chart it does not return: at a draw is within rad of a half-turn with probability , where the uniform distribution puts . The mean is a mode only while every eigenvalue of is below (Where the modes are); beyond that the density against Haar measure rises away from the mean, to a shell at the angle for an isotropic scale, and inside that shell the term’s gradient pushes an estimate away from the mean it was meant to stay near. No isotropic normal is closer to uniform than in total variation.
None of this is an error in the normal. Its density and its sampler are exact at every scale, and a scale of rad is a legitimate, if unusual, noise. What is wrong is a reading: that a large scale means little is known. Four ways of meeting it follow.
Refusing. A normal on a curved type could refuse a constant scale with an eigenvalue of above on a curved block. It cannot refuse a scale that is a quantity or computed from one: a scale with a prior of its own is large with some probability, a refusal at one value of a random scale is not a law, and a term that turned non-finite there would cut the scale’s prior without saying so. The rule would therefore hold for constants and not for the same number arriving any other way, and the threshold would be a property of the chart’s volume that the normal would have to be told of each type. It would also refuse laws that are exact and may be meant.
Bounding the scale. A saturating function could be put between the scale given and the scale used, such as with , so that the mean stays a mode and no mass reaches the cut. Its costs are these.
- It does not say “unknown” either. Every large scale becomes , which at has a median angle of rad against the uniform’s , and is from it in total variation. A prior written with would be a confident statement that the rotation is within about of its mean, and nothing non-finite would ever reveal it. No function of the scale can do better, because the family has no member near the uniform distribution at any scale.
- It changes what every scale means. A smooth saturation is not the identity anywhere: the one above turns rad into . A scale would no longer be the standard deviation of the noise in the chart, which is the one thing the normal promises of it, and a function that is the identity below a threshold and saturates above it is not smooth where they join.
- It makes a large scale unidentifiable. The log-density’s derivative in is multiplied by the saturation’s logarithmic slope, which tends to zero, and the scale’s block of the expected information, exact today (the normal’s note), by its square. An estimated scale that wanders past the bound stops being pulled back by the data.
- It has no form for a full covariance. The condition is on the eigenvalues of , the normal reads its scale through a triangular factor, and a saturation of eigenvalues needs a decomposition the normal otherwise never computes. On a product, such as a rotation with a position, it would have to act on the curved block of a covariance that correlates the two.
Replacing the law. A law could be chosen that tends to the uniform distribution as its scale grows. The natural one is (6), the Gaussian of the residual as a density against the reference measure: its mode is its mean at every scale, it is the law that least squares of the whitened residual estimates exactly, and its limit is the uniform distribution. It is not the normal, and making the normal into it would undo what the normal’s entry chose it for. Its normalizer is a function of the scale with a closed form only in special cases, (7) for an isotropic scale on the rotations, so a full or an estimated scale has no exact term; and its draw is by rejection, with a random number of variates and an acceptance that falls to at from a normal proposal, where the normal’s draw is a fixed smooth function of its variates. On the flat types it is the normal, so it would be a second law on curved types only, beside the first. As a distribution of its own, with an isotropic scale, it is a candidate for a later entry, and Student t noise in the chart, of which the uniform is one member, is another.
Documenting. The normal stays as it is, exact at every scale, and the site says what a large scale is: that the mean is a mode only below a scale of about one radian in the chart, where the mass goes beyond it, and that the uniform distribution is how “unknown” is said.
A random scale needs no rule. A prior on a scale that reaches past one radian with small probability gives those draws the law Proposition 5 describes, with small probability, and the model remains exactly what was written. A model that means “the noise is either small or the measurement says nothing” is a mixture of a normal and the uniform distribution, and this entry supplies its second component.
In skoro’s terms#
- A type of finite mass declares and a uniform draw, a map from variates to its storage.
Rotationdeclares and (2); a sphere and the first map of Proposition 4; a product has the sum of its factors’ log-masses and their draws side by side. The mass is checked against the integral of the declared volume, (8), and the draw against the law of its coordinates in a chart. - A categorical type needs no declaration. Its mass is and its draw is (3), from one variate of the quantity’s key.
- The uniform distribution is a term with no parameters. It scores one random quantity of a type of finite mass, continuous or categorical, with the constant (1). Nothing is differentiated: its gradient and Hessian products with respect to the quantity are zero, in every chart, and it has no scale and no mean to differentiate with respect to.
- The quantity it scores is random, drawn in a generation by the type’s uniform draw on the host, from the variates of its key, as the normal’s quantity is drawn by the retraction. It may be observed, and then the term is a constant of the data.
- In a linearization it is a factor with no rows. The term is the improper Gaussian factor with a matrix of no rows, no linear part and the constant : flat in every direction, exactly, with nothing approximated. It adds nothing to the rows a step is solved from, and its constant enters the evidence of a Laplace approximation. A quantity that no other term bears on has then no rows at all, and the problem is singular in its block, as it should be, since its posterior is uniform and has no mode. On a discrete quantity the term is a constant of the data when the quantity is observed, and a free discrete quantity is refused by a linearization as it always was.
- The normal is unchanged. It accepts every scale on every type it accepted, its term, its sampler and its roles are as its entry left them, and what this entry revises is what its pages say of a large scale on a curved type.
- The tests draw from the normal on
Rotationat the scales of the table and compare the median angle with , the median length of a standard normal vector of , and draw from the uniform distribution and compare the angle from a fixed rotation with its distribution function ; and count the draws of a categorical type against .
Open questions#
None remain.
Built on by
- The uniform distribution on compact types, and broad scales of a normal on a curved type: Implementation A type of finite mass declares its log-mass and its uniform draw in the core, `Rotation` declares both, and a new crate `skoro-uniform` holds the distribution `Uniform`, a constant term with an exact sampler and an empty residual, on curved and categorical types alike; the normal gains only documentation and a test of what a large scale does.