iws.DataFit is expressed as priors on the fit parameters. Each prior pairs a parameter name with a distribution from iws.stats. For why regularization is needed and how to choose prior strengths, see the Regularization Guide.
Distributions
| Schema | Use for |
|---|---|
iws.stats.Normal(mean=..., std=...) | Gaussian prior, additive scale |
iws.stats.LogNormal(mean=..., std=...) | Strictly-positive parameter spanning orders of magnitude (e.g. solid-phase diffusivities) |
iws.stats.Uniform(lb=..., ub=...) | Hard support; equivalent to bounds with constant density |
iws.stats.MultivariateNormal(...) | Correlated priors across multiple parameters |
A regularized fit
priors dict adds a regularization term to the cost function so deviations from the prior mean are penalised in proportion to the prior’s inverse variance.
Attaching priors via Parameter
Priors can also be attached directly to a Parameter rather than passed as a separate dict — useful when the prior is intrinsic to that parameter:
Why LogNormal for diffusivities
Solid-phase diffusivities span many orders of magnitude (often to m²/s). A Normal prior on the raw value is hard to specify — mean ± std doesn’t reflect order-of-magnitude uncertainty. A LogNormal prior treats the parameter on a log scale, so “mean ± 1 std” corresponds to a factor of — much more natural. The mean=-32.2 in the example above is the natural log of , so the prior is centred on a typical particle diffusivity.
Regularization (theory)
Ridge regression, MAP estimation, bias–variance tradeoff.
Data Fitting overview
Putting priors together with objectives and optimisers.