calibr8.contrib.normal

This module implements reusable calibration models with Normal distributions for the dependent variable.

class calibr8.contrib.normal.BaseAsymmetricLogisticN(*, independent_key: str, dependent_key: str, sigma_degree: int = 0, theta_names: Sequence[str] | None = None)

Bases: ContinuousUnivariateModel, NormalNoise

Attributes:
pymc_dist
theta_fitted

The parameter vector that describes the fitted model.

theta_guess

Initial guess that was used to fit the model.

theta_names

Names of model parameters in a fixed order.

theta_timestamp

The timestamp when theta_fitted was set.

Methods

infer_independent(y, *, lower, upper[, ...])

Infer the posterior distribution of the independent variable given the observations of the dependent variable.

likelihood(*, y, x[, theta, scan_x])

Likelihood of observation (dependent variable) given the independent variable.

load(filepath)

Instantiates a model from a JSON file of key properties.

loglikelihood(*, y, x[, name, replicate_id, ...])

Loglikelihood of observation (dependent variable) given the independent variable.

objective(independent, dependent[, minimize])

Creates an objective function for fitting to data.

predict_dependent(x, *[, theta])

Predicts the parameters mu and sigma of a normal distribution which characterizes the dependent variable given values of the independent variable.

predict_independent(y, *[, theta])

Predict the independent variable using the inverse trend model.

save(filepath)

Save key properties of the calibration model to a JSON file.

scipy_dist

to_pymc

to_scipy

predict_dependent(x, *, theta=None)

Predicts the parameters mu and sigma of a normal distribution which characterizes the dependent variable given values of the independent variable.

Parameters:
xarray-like

values of the independent variable

thetaoptional, array-like
parameter vector of the calibration model:

5 parameters of asymmetric logistic model for mu [sigma_degree] parameters for sigma (lowest degree first)

Returns:
muarray-like

values for the mu parameter of a normal distribution describing the dependent variable

sigmaarray-like or float

values for the sigma parameter of a normal distribution describing the dependent variable

predict_independent(y, *, theta=None)

Predict the independent variable using the inverse trend model.

Parameters:
yarray-like

observations

thetaoptional, array-like
parameter vector of the calibration model:

5 parameters of asymmetric logistic model for mu [sigma_degree] parameters for sigma (lowest degree first)

Returns:
xarray-like

predicted independent values given the observations

class calibr8.contrib.normal.BaseExponentialModelN(*, independent_key: str, dependent_key: str, sigma_degree: int = 0, fixed_intercept: float | None = None, theta_names: Sequence[str] | None = None)

Bases: ContinuousUnivariateModel, NormalNoise

Attributes:
pymc_dist
theta_fitted

The parameter vector that describes the fitted model.

theta_guess

Initial guess that was used to fit the model.

theta_names

Names of model parameters in a fixed order.

theta_timestamp

The timestamp when theta_fitted was set.

Methods

infer_independent(y, *, lower, upper[, ...])

Infer the posterior distribution of the independent variable given the observations of the dependent variable.

likelihood(*, y, x[, theta, scan_x])

Likelihood of observation (dependent variable) given the independent variable.

load(filepath)

Instantiates a model from a JSON file of key properties.

loglikelihood(*, y, x[, name, replicate_id, ...])

Loglikelihood of observation (dependent variable) given the independent variable.

objective(independent, dependent[, minimize])

Creates an objective function for fitting to data.

predict_dependent(x, *[, theta])

Predicts the parameters mu and sigma of a normal distribution which characterizes the dependent variable given values of the independent variable.

predict_independent(y, *[, theta])

Predict the independent variable using the inverse trend model.

save(filepath)

Save key properties of the calibration model to a JSON file.

scipy_dist

to_pymc

to_scipy

predict_dependent(x, *, theta=None)

Predicts the parameters mu and sigma of a normal distribution which characterizes the dependent variable given values of the independent variable.

Parameters:
xarray-like

values of the independent variable

thetaoptional, array-like

Parameter vector of the calibration model. Depending on the fixed_intercept setting these are [I, L, k] or [L, k] parameters of exponential model for mu. Followed by parameters for the model for sigma (lowest degree first).

Returns:
muarray-like

values for the mu parameter of a normal distribution describing the dependent variable

sigmaarray-like or float

values for the sigma parameter of a normal distribution describing the dependent variable

predict_independent(y, *, theta=None)

Predict the independent variable using the inverse trend model.

Parameters:
yarray-like

observations

thetaoptional, array-like

Parameter vector of the calibration model. Depending on the fixed_intercept setting these are [I, L, k] or [L, k] parameters of exponential model for mu. Followed by parameters for the model for sigma (lowest degree first).

Returns:
xarray-like

predicted independent values given the observations

class calibr8.contrib.normal.BaseLogIndependentAsymmetricLogisticN(*, independent_key: str, dependent_key: str, sigma_degree: int = 0, theta_names: Sequence[str] | None = None)

Bases: ContinuousUnivariateModel, NormalNoise

Attributes:
pymc_dist
theta_fitted

The parameter vector that describes the fitted model.

theta_guess

Initial guess that was used to fit the model.

theta_names

Names of model parameters in a fixed order.

theta_timestamp

The timestamp when theta_fitted was set.

Methods

infer_independent(y, *, lower, upper[, ...])

Infer the posterior distribution of the independent variable given the observations of the dependent variable.

likelihood(*, y, x[, theta, scan_x])

Likelihood of observation (dependent variable) given the independent variable.

load(filepath)

Instantiates a model from a JSON file of key properties.

loglikelihood(*, y, x[, name, replicate_id, ...])

Loglikelihood of observation (dependent variable) given the independent variable.

objective(independent, dependent[, minimize])

Creates an objective function for fitting to data.

predict_dependent(x, *[, theta])

Predicts the parameters mu and sigma of a normal distribution which characterizes the dependent variable given values of the independent variable.

predict_independent(y, *[, theta])

Predict the independent variable using the inverse trend model.

save(filepath)

Save key properties of the calibration model to a JSON file.

scipy_dist

to_pymc

to_scipy

predict_dependent(x, *, theta=None)

Predicts the parameters mu and sigma of a normal distribution which characterizes the dependent variable given values of the independent variable.

Parameters:
xarray-like

values of the independent variable

thetaoptional, array-like
parameter vector of the calibration model:

5 parameters of log-independent asymmetric logistic model for mu [sigma_degree] parameters for sigma (lowest degree first)

Returns:
muarray-like

values for the mu parameter of a normal distribution describing the dependent variable

sigmaarray-like or float

values for the sigma parameter of a normal distribution describing the dependent variable

predict_independent(y, *, theta=None)

Predict the independent variable using the inverse trend model.

Parameters:
yarray-like

observations

thetaoptional, array-like
parameter vector of the calibration model:

5 parameters of log-independent asymmetric logistic model for mu [sigma_degree] parameters for sigma (lowest degree first)

Returns:
xarray-like

predicted independent values given the observations

class calibr8.contrib.normal.BasePolynomialModelN(*, independent_key: str, dependent_key: str, mu_degree: int, sigma_degree: int = 0, theta_names: Sequence[str] | None = None)

Bases: ContinuousUnivariateModel, NormalNoise

Attributes:
pymc_dist
theta_fitted

The parameter vector that describes the fitted model.

theta_guess

Initial guess that was used to fit the model.

theta_names

Names of model parameters in a fixed order.

theta_timestamp

The timestamp when theta_fitted was set.

Methods

infer_independent(y, *, lower, upper[, ...])

Infer the posterior distribution of the independent variable given the observations of the dependent variable.

likelihood(*, y, x[, theta, scan_x])

Likelihood of observation (dependent variable) given the independent variable.

load(filepath)

Instantiates a model from a JSON file of key properties.

loglikelihood(*, y, x[, name, replicate_id, ...])

Loglikelihood of observation (dependent variable) given the independent variable.

objective(independent, dependent[, minimize])

Creates an objective function for fitting to data.

predict_dependent(x, *[, theta])

Predicts the parameters mu and sigma of a normal distribution which characterizes the dependent variable given values of the independent variable.

predict_independent(y, *[, theta])

Predict the independent variable using the inverse trend model.

save(filepath)

Save key properties of the calibration model to a JSON file.

scipy_dist

to_pymc

to_scipy

predict_dependent(x, *, theta=None)

Predicts the parameters mu and sigma of a normal distribution which characterizes the dependent variable given values of the independent variable.

Parameters:
xarray-like

values of the independent variable

thetaoptional, array-like
parameter vector of the calibration model:

[mu_degree] parameters for mu (lowest degree first) [sigma_degree] parameters for sigma (lowest degree first)

Returns:
muarray-like

values for the mu parameter of a normal distribution describing the dependent variable

sigmaarray-like or float

values for the sigma parameter of a normal distribution describing the dependent variable

predict_independent(y, *, theta=None)

Predict the independent variable using the inverse trend model.

Parameters:
yarray-like

observations

thetaoptional, array-like
parameter vector of the calibration model:

[mu_degree] parameters for mu (lowest degree first) [sigma_degree] parameters for sigma (lowest degree first)

Returns:
xarray-like

predicted independent values given the observations