The softmax kernel of an extended-real score #
This file defines ProbabilityTheory.Kernel.softmax, the kernel whose row at w is proportional
to the exponential of an extended-real score. A point of score ⊥ gets no mass, so the score
both ranks the points and says which of them are available.
Main definitions #
ProbabilityTheory.Kernel.softmax: the weight kernel ofEReal.exp (score w u).
Main results #
ProbabilityTheory.Kernel.softmax_coe_real_singleton: a real score gives each rowReal.softmaxof the score.ProbabilityTheory.Kernel.softmax_real_singleton_lt_iff: row preference is score comparison.ProbabilityTheory.Kernel.softmax_real_singleton_of_pair: with two available points the share of one is the logistic function of the score difference.ProbabilityTheory.Kernel.softmax_eq_tilted,ProbabilityTheory.Kernel.isGreatest_freeEnergy_softmax: a row is the uniform measure on the available points tilted by the score, and so maximizes the expected score less the divergence from that uniform measure, by the Gibbs variational principle.
The softmax kernel of an extended-real score has row w proportional to the exponential of the
score, so a point of score ⊥ gets no mass.
Equations
- ProbabilityTheory.Kernel.softmax score = ProbabilityTheory.Kernel.ofWeights fun (w : α) (u : β) => (score w u).exp
Instances For
The softmax kernel is a probability kernel whenever every row has a point of score above ⊥
and no score is ⊤.
A point of score ⊥ gets no mass.
A point of score above ⊥ gets positive mass when no score is ⊤.
Two rows whose scores differ by a real constant are the same.
Two scores differing by a real constant per row give the same kernel, since a term that does not depend on the point cancels in the normalization.
Row preference of the softmax kernel is score comparison, since the normalization cancels.
A real-valued score gives each row the softmax of the score.
A real-valued score excludes no point, so row preference is comparison of reals.
When exactly two points of a row have score above ⊥, the share of one is the logistic
function of the score difference.
The softmax row as a Gibbs measure #
A row of the softmax kernel is the uniform measure on the points of score above ⊥, tilted by
the score.
A row of the softmax kernel attains the log partition function as its free energy relative to
the uniform measure on the points of score above ⊥.
A row of the softmax kernel is the Gibbs optimizer. Among the distributions absolutely
continuous with respect to the uniform measure on the points of score above ⊥, it has the
greatest expected score less divergence from that uniform measure.