Skip to content

Likelihoods and priors

A likelihood is the noise model of a measurement, and a prior states what is known about a parameter before the data. See statistical estimation.

Likelihoods

Pass one as likelihood= of a Measurement.

diff_soup.inference.Gaussian

Independent Gaussian noise with standard deviation sigma.

Pass sigma, or scale in its place, but not both.

Parameters:

Name Type Description Default
sigma

The standard deviation, one value or one per entry of the measured values.

None
scale

Another name for sigma.

None

diff_soup.inference.CorrelatedGaussian

Gaussian noise correlated across the values of one time, with covariance cholesky @ cholesky.T.

For a measurement with one value per time, a factor with one row per time correlates the times instead.

Parameters:

Name Type Description Default
cholesky

The lower Cholesky factor of the covariance, one row per value of a time.

required

diff_soup.inference.StudentT

Independent Student-t noise with df degrees of freedom and scale scale.

It tolerates outliers, and approaches Gaussian noise of standard deviation scale as df grows.

Parameters:

Name Type Description Default
df

The degrees of freedom, positive, one value or one per entry of the measured values.

required
scale

The scale of the noise, positive, one value or one per entry.

required

diff_soup.inference.Poisson

Independent Poisson noise of counts, with expected count exposure times the predicted value.

The observed values must be counts, non-negative integers.

Parameters:

Name Type Description Default
exposure

The positive factor from predicted value to expected count, one value or one per entry, by default 1.0.

required

diff_soup.inference.LogNormal

Independent log-normal noise, with the logarithm of each value Gaussian of standard deviation scale.

The predicted value is the mean of the observed value, and both must be positive.

Parameters:

Name Type Description Default
scale

The standard deviation of the logarithm, positive, one value or one per entry.

required

diff_soup.inference.MultiplicativeGaussian

Independent Gaussian noise with standard deviation scale times the absolute predicted value.

An observed value of zero is refused unless its time is masked out.

Parameters:

Name Type Description Default
scale

The relative standard deviation, positive, one value or one per entry.

required

Priors

A MAP fit needs one on every fitted parameter handle.

diff_soup.inference.NormalPrior dataclass

A normal prior with mean mean and standard deviation scale.

Declare it as prior= of spec.param or spec.function, for a MAP fit.

Parameters:

Name Type Description Default
mean Any

The mean, one value or one per entry of the parameter.

required
scale Any

The standard deviation, positive, one value or one per entry.

required

diff_soup.inference.LogNormalPrior dataclass

A log-normal prior with median median and standard deviation log_sd of the logarithm.

Declare it as prior= of spec.param, for a MAP fit of a positive parameter.

Parameters:

Name Type Description Default
median Any

The median, positive, one value or one per entry of the parameter.

required
log_sd Any

The standard deviation of the parameter's logarithm, positive, one value or one per entry.

required

diff_soup.inference.GaussianCoefficientPrior dataclass

A normal prior on the coefficients of a function, centered on its declared coefficients.

Declare it as prior= of spec.function, for a MAP fit. Coefficient n, counted from 0, has standard deviation scale / (1 + n * (n + 1)) ** (smoothness / 2).

Parameters:

Name Type Description Default
scale float

The standard deviation of the first coefficient, positive.

required
smoothness float

How fast the standard deviation falls with the coefficient index, non-negative.

2.0