Predictor

Contents

Predictor#

class liesel_ptm.Predictor(name)[source]#

Bases: Var

Organizes the terms of a structured additive predictor.

Parameters:

name (str) – Name of the predictor.

See also

StructuredAdditiveTerm

Term in a structured additive predictor.

LinearTerm

Linear term.

RandomIntercept

Random intercept term.

Examples

Terms must be added to the predictor using the += syntax:

import liesel_ptm as ptm
import numpy as np

x = np.linspace(size=10)

predictor = ptm.Predictor(name="pred")
predictor += ptm.LinearSmooth(x, name="term1")

Terms can be accessed using both bracket- and dot-syntax, using the names of the terms:

predictor["term1"]
predictor.term1

Methods

predict

Returns predicted values for this predictor.

with_intercept

Alternative constructor for initializing the predictor with an intercept.

Attributes

hyper_parameters

Collects the names of the hyperparameters in this predictor and returns them in a list.

nuts_params

(Deprecated) List of parameters to be sampled via the No-U-Turn Sampler (NUTS).

parameters

Collects the names of the parameters in this predictor and returns them in a list.

terms

Dictionary of terms in this predictor.

intercept

Intercept variable (if any).