Skip to main content

Probit

Probit()

Moderated softmax, or moderated sigmoid, by the probit approximation.

With logits \(f \sim \mathcal{N}(\bar f, V)\) over \(K\) classes, the sigmoid \(s\) and

\[\kappa(v) = (1 + \pi v / 8)^{-1/2},\]

the class probabilities are:

  • \(K \ge 3\): the softmax of the centred logits \(g = f - \frac{1}{K} \sum_k f_k\), each scaled by its own variance, \(p = \operatorname{softmax}_k\big(\kappa(\operatorname{Var} g_k) \, \mathbb{E}[g_k]\big)\).
  • \(K = 2\): the probit of the logit difference \(d = f_1 - f_2\), \(p = [s(z), s(-z)]\) with \(z = \kappa(\operatorname{Var} d) \, \mathbb{E}[d]\).
  • A Bernoulli: the moderated sigmoid \(s\big(\kappa(V_{ii}) \, \bar f_i\big)\) per entry \(i\).

Softmax ignores a shift shared by all logits, but the variance along that shift is often huge (the GGN has a null direction there), and using it would flatten the result toward uniform. Centring, or the difference for two classes, removes it.

Outputs may have extra axes ([N, T, K], or [N, K, T] with class_dim=1): each position uses its own \(K \times K\) block of the per-input covariance. A SampleCov and a FactorCov are read through diagonal() only: their draws or factor are centred over the classes (or differenced) first, so large vocabularies never need a \(K \times K\) block. A Bernoulli needs only the variances, read through diagonal() from any covariance.

Known limitation: on \(K \times K\) blocks in float32, a large shared-shift variance cancels the small differences, and the centred or difference variance can come out zero or negative. Float64 or Linearized(strategy="forward-mode") (whose FactorCov is centred before the variance is formed) avoid it.

Methods

Name Description
supports True for a Categorical or a Bernoulli.

supports

Probit.supports(lik, f_mu, /)

True for a Categorical or a Bernoulli.

Parameters

Name Type Description Default
lik Likelihood The likelihood. required
f_mu Tensor The output mean. required

Returns

Name Type Description
bool True when __call__ can turn outputs like f_mu into a distribution.