cleverly.bases.Basis#

class cleverly.bases.Basis(*args, **kwargs)[source]#

What a working model of the modifiers provides.

The protocol is not runtime-checkable: check_basis() decides what a working model may be, by its concrete type and its declaration.

Attributes:
termstuple of str

One name per design column.

n_termsint

The number of design columns.

max_sizeint

The largest size truncate() accepts.

basis_kind{“known”, “estimated”}

"known" for a basis fixed before the fit.

columnstuple of str

The modifier columns the basis reads.

Methods#

Basis.evaluate(frame: Any, modifiers: Modifiers | None = None) → ndarray[source]#

The (n, p) design at the rows of frame.

Parameters:
framedataframe or mapping

Rows holding the modifier columns.

modifiersModifiers or None

The declared domains and levels, when the basis reads them.

Returns:
ndarray

One column per term.

Basis.truncate(k: int) → Basis[source]#

The same basis with each component cut to its first k functions.

Parameters:
kint

The number of functions to keep in each component.

Returns:
Basis

The truncated basis.

Attributes#

Basis.basis_kind#

"known" for a basis fixed before the fit.

Basis.columns#

The modifier columns the basis reads.

Basis.max_size#

The largest size truncate() accepts.

Basis.n_terms#

The number of design columns.

Basis.terms#

One name per design column.