Point-Estimate Fitting¶
adam_fit_deduction maximises the corpus log-marginal
\(\sum_n \log Z(s_n; \mathbf{w})\) under an optional isotropic
Normal prior on the deduction's learnable log-weights. Each
\(\log Z\) is computed exactly by the chart's LogProb-semiring
fixed point; autograd through the agenda's semiring operations
gives the exact gradient
\(\nabla_\mathbf{w} \log Z(s; \mathbf{w})
= \mathbb{E}_{d \mid s}[\phi(d)]\) (the standard inside-outside
identity).
fit
¶
Point-estimate fitting of a weighted deduction system.
adam_fit_deduction runs gradient descent on the
deduction's learnable log-weights to maximise the corpus
log-marginal :math:\sum_n \log Z(s_n; \mathbf{w}), optionally
under an isotropic Normal prior (MAP). Each :math:\log Z(s;
\mathbf{w}) is computed exactly by the chart's LogProb-semiring
fixed point; autograd through the agenda's semiring operations
yields the exact gradient
:math:\nabla_{\mathbf{w}} \log Z(s; \mathbf{w})
= \mathbb{E}_{d \mid s}[\phi(d)] (the standard inside-outside
identity).
adam_fit_deduction
¶
adam_fit_deduction(ded: DeductionSystem, corpus: Sequence[Sequence[str]], *, steps: int = 300, lr: float = 0.05, prior_scale: float | None = None) -> list[float]
Maximise the corpus log-marginal under an optional Normal prior on the parameters.
| PARAMETER | DESCRIPTION |
|---|---|
ded
|
Deduction whose
TYPE:
|
corpus
|
Each sentence is a sequence of token strings the deduction's axiom injector accepts.
TYPE:
|
steps
|
Adam steps.
TYPE:
|
lr
|
Adam learning rate.
TYPE:
|
prior_scale
|
If supplied, adds a Gaussian regulariser
:math:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[float]
|
The loss trajectory; length == |