DirichletLaplacePrior._initial_scales#
- DirichletLaplacePrior._initial_scales(context, reference)[source]#
Uniform simplex, unit local scales, unit global magnitude.
Every \(\phi_{ij}\) starts at \(1/m\), the centre of the simplex, with \(\psi_{ij} = 1\) and \(\tau = 1\), so the first coefficient draw is under a Gaussian of standard deviation \(1/m\) on the standardized scale: tight, and the first sweeps redistribute the budget from there.
- Parameters:
- Return type:
- Returns:
{"psi", "phi"}of shape(k * p, k)and{"tau"}of shape(1,);phisums to one.- Raises:
SpecificationError – If a hyperparameter is out of range.
Example
>>> import numpy as np >>> from cultivars.bayes.priors import PriorContext >>> ctx = PriorContext( ... k_endog=2, order=1, scales=np.ones(2), presample_mean=np.zeros(2) ... ) >>> prior = DirichletLaplacePrior() >>> state = prior._initial_scales(ctx, prior._unit_ratio(ctx)) >>> state["phi"] array([[0.25, 0.25], [0.25, 0.25]]) >>> state["psi"].sum(), state["tau"] (np.float64(4.0), array([1.]))