Priors and Parameter Initialization¶
Every free parameter carries a prior — a probability distribution over its values. The prior does double duty: a Bayesian sampler uses it as the prior in the usual sense, and an optimizer uses it as the distribution its initial population is drawn from. A prior is an orthogonal distribution family × scale: the family (Normal, Uniform, Gamma, …) fixes the shape, the scale (linear or base-10 logarithmic) fixes the space the parameter is sampled, proposed, and stored in. The family is always evaluated in that scale.
The *_var keyword¶
A prior is declared with a *_var keyword whose name encodes the family and
the scale. The naming is regular: a family with base b yields b_var
(linear) and logb_var (log10). So the Normal family gives normal_var and
lognormal_var; Gamma gives gamma_var and loggamma_var; and so on.
The value gives the parameter id followed by the family’s parameters:
uniform_var = k1__FREE 0.01 100 # id, lower, upper
normal_var = k2__FREE 1.0 0.3 # id, mean, sd
gamma_var = k3__FREE 2.0 0.5 # id, shape, scale
exponential_var = k4__FREE 1.0 # id, scale (one-parameter family)
The full per-keyword syntax is under the configuration reference.
Parameter scale¶
The scale is the space the parameter is sampled, proposed, and stored in —
linear or log10. The prior and the proposal arithmetic share it, and the
posterior target is defined directly in this scale with no change of variables.
The log prefix on a keyword selects log10; a bare “log” always means log10
across PyBNF, matching the noise-model additive scale.
Log-scale priors are the right choice for a rate constant or concentration that
ranges over orders of magnitude. (The natural-log scale is reachable only
through the labelled parameter record below, not the
positional *_var grammar.)
Support and reflecting bounds¶
A family’s support — the region where its density is nonzero — is intrinsic to the family: Uniform is finite, Normal and Laplace are unbounded, and the positive families (Gamma, Exponential, half-Normal, …) are bounded below at zero.
Reflecting bounds are a separate idea. They are a box a proposal is folded
back into during a fit, and they exist only for the box-shaped
uniform_var / loguniform_var priors, which take an optional trailing flag
— b (or blank) keeps the parameter bounded, so a proposal that would
leave the box is reflected back in; u makes it unbounded, letting the
search leave the initial range:
uniform_var = x__FREE 10 30 u # sample in [10, 30], but allow moves outside
The other finite-support families (for example Beta on [0, 1]) draw from
their own density rather than a reflecting box, so they take no such flag.
Distribution families¶
The families below are all reachable through the positional *_var grammar.
Each row lists the linear keyword; every family also has the log-prefixed
log10 form (lognormal_var, loggamma_var, …).
Family (linear keyword) |
Parameters |
Support |
Notes |
|---|---|---|---|
|
lower, upper |
finite box |
The box-bounded prior; takes the |
|
mean, sd |
\((-\infty, \infty)\) |
Gaussian. |
|
location, scale |
\((-\infty, \infty)\) |
Heavier-tailed than Normal. |
|
location, scale |
\((-\infty, \infty)\) |
Very heavy tails. |
|
location, scale |
\((-\infty, \infty)\) |
Extreme-value. |
|
location, scale |
\((-\infty, \infty)\) |
Symmetric, slightly heavier-tailed than Normal. |
|
shape, scale |
\((0, \infty)\) |
Positive; PEtab-catalog parity. |
|
shape, scale |
\((0, \infty)\) |
Conjugate prior for a variance. |
|
shape, scale |
\((0, \infty)\) |
Lifetime / time-to-event. |
|
alpha, beta |
\([0, 1]\) |
The canonical prior for a fraction. |
|
scale |
\((0, \infty)\) |
One-parameter. |
|
dof |
\((0, \infty)\) |
One-parameter. |
|
scale |
\((0, \infty)\) |
One-parameter. |
|
scale |
\((0, \infty)\) |
The right half of a zero-centered Normal; a mild positive scale prior. |
|
scale |
\((0, \infty)\) |
The right half of a zero-centered Cauchy; a weakly-informative scale prior. |
The positive-support and log-scale families are natural priors for an estimated noise parameter — a standard deviation or dispersion that must stay positive.
No prior: start points¶
The keywords var (linear) and logvar (log10) give a parameter a single
start value and no prior distribution. They are the start points for the
start-point optimizers — Simplex, Powell, and CMA-ES. A no-prior parameter still
carries a scale and is varied during the fit; it simply contributes nothing to
the log prior and cannot be prior-sampled:
var = k__FREE 1.5
logvar = k__FREE 0.001
Multi-parameter priors: the parameter record¶
The positional *_var grammar carries at most two distribution parameters, so
a family with three — like Student-t (degrees of freedom, location, scale) —
has no positional keyword. These are authored instead through the edition-2
labelled parameter: record, which names each field, and which is also where
the natural-log parameter scale is selected. Tutorial lesson 32_prior_gallery
walks through the full catalog, including the Student-t record.
See also¶
Initialization — how the prior seeds an optimizer’s starting population, including Latin-hypercube sampling.
Configuration Keys — the exact per-keyword configuration syntax.
Noise Models and Objective Functions — the companion reference; an estimated noise parameter is a free parameter and takes a prior like any other.
PEtab interoperability — PyBNF imports and exports PEtab v2 priors, whose catalog these families mirror.
API reference — the
pybnf.priorsmodule docstrings for thePriorfamilies and their scale/bounding infrastructure.