pysr3.priors module

Prior distributions for model parameters

class pysr3.priors.GaussianPrior(params: Dict)

Bases: object

Implements Gaussian Prior for various models

Creates GaussianPrior

Parameters:

params (dict[str: tuple(float, float)]) – gaussian prior for variances of random effects. Same format as above.

forget()

Releases all problem-dependent quantities

Returns:

None

gradient(x)

Evaluates the gradient of the prior with respect to the vector of fixed effects

Parameters:

x (ndarray) – vector of parameters

Returns:

gradient

hessian(_)

Evaluates Hessian of the prior with respect to the vector of fixed effects

Returns:

Hessian

instantiate(problem_columns)

Instantiates a Gaussian prior with problem-dependent quantities

Parameters:

problem_columns (List[str]) – Names of the columns for a particular dataset. Matches the elements of self.params (dict) with the columns of a particular dataset.

Returns:

None

loss(x)

Value of the prior at beta, gamma.

Parameters:

x (ndarray) – vector of parameters

Returns:

value of the prior.

class pysr3.priors.NonInformativePrior

Bases: Prior

Implements a non-informative prior

Creates NonInformativePrior

forget()

Releases all problem-dependent values

Returns:

None

static gradient(_)

Evaluates the gradient of the prior with respect to the vector of fixed effects

Returns:

gradient

static hessian(_)

Evaluates Hessian of the prior with respect to the vector of random effects

Returns:

Hessian w.r.t. (gamma, gamma)

instantiate(problem)

Instantiates the prior based on the problem

Parameters:

problem (LMEProblem)

Returns:

None

static loss(_)

Value of the prior at beta, gamma.

Returns:

value of the prior.

class pysr3.priors.Prior

Bases: object