cleverly.bases.Interactions#

class cleverly.bases.Interactions(basis: Additive, order: int = 2)[source]#

An additive basis with the products of its components up to an interaction order.

Order 1 is the additive basis. Order 2 adds, for every pair of components, the products of their non-intercept columns; order 3 every triple; and so on.

Parameters:
basisAdditive

The additive basis whose components interact.

orderint

The largest number of components in one product.

Methods#

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

The additive design, then the product columns.

Parameters:
framedataframe or mapping

Rows holding the modifier columns.

modifiersModifiers, optional

The declared schema.

Returns:
ndarray

The design.

Interactions.named(modifiers: Modifiers | None) → Interactions[source]#

This basis with every level set resolved from modifiers.

Parameters:
modifiersModifiers or None

The declared schema.

Returns:
Interactions

A basis whose terms carry the level names.

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

The additive basis cut to k, with the same order.

Parameters:
kint

A size of at least one.

Returns:
Interactions

The truncated basis.

Attributes#

Interactions.basis_kind#

The additive basis’s declaration.

Interactions.columns#

The modifier columns the components read.

Interactions.max_size#

The additive basis’s size.

Interactions.n_terms#

The number of design columns.

Interactions.order: int = 2#
Interactions.terms#

The additive terms, then one name per product column.

Interactions.basis: Additive#