gammy.formulae.Formula

Formula

class Formula(terms, prior)[source]

Bases: object

Basis manipulation and design matrix creator

Parameters
termsList[Callable]

Each element is a list of basis functions and corresponds to a term in the additive model formula

priorTuple[np.ndarray]

Mean and precision matrix of the Gaussian prior distribution

__add__(other)gammy.formulae.Formula[source]

Addition of formulae

__call__(*input_maps: Iterable[gammy.arraymapper.ArrayMapper])gammy.formulae.Formula[source]

Make the object callable

__len__()int[source]

Number of terms in the formula

__mul__(input_map: gammy.arraymapper.ArrayMapper)gammy.formulae.Formula[source]

Multiplication with input map

Note: This is not a Formula × Formula multiplication! See Kron() for that use case.

Examples

from gammy.arraymapper import x
from gammy.formulae import Scalar

formula = Scalar() * x
design_matrix(input_data: numpy.ndarray, i: Optional[int] = None)[source]
prior

Prior mean and precision

terms

List of basis functions