StrctInteractionTerm.f()

StrctInteractionTerm.f()#

classmethod StrctInteractionTerm.f(*marginals, common_scale=None, fname='ta', inference=None, include_main_effects=False, _update_on_init=True)[source]#

Alternative constructor with more opinionated automatic naming.

Parameters:
  • *marginals (StrctTerm) – Marginal terms.

  • common_scale (ScaleIG | VarIGPrior | Var | Array | ndarray | bool | number | bool | int | float | complex | None, default: None) – A single, common scale to cover both marginal dimensions, resulting in an isotropic tensor product.

  • fname (str, default: 'ta') – Function-name prefix used when constructing the term name.

  • include_main_effects (bool, default: False) – If True, the marginal terms will be added to this term’s value.

  • _update_on_init (bool, default: True) – Whether to update the term upon initialization.

Return type:

Self

Examples

>>> x = jnp.linspace(0.0, 1.0, 4)
>>> y = jnp.linspace(1.0, 2.0, 4)
>>> bx = Basis(
...     jnp.column_stack([jnp.ones_like(x), x]), xname="x", penalty=jnp.eye(2)
... )
>>> by = Basis(
...     jnp.column_stack([jnp.ones_like(y), y]), xname="y", penalty=jnp.eye(2)
... )
>>> term = StrctInteractionTerm.f(
...     StrctTerm.f(bx, scale=1.0),
...     StrctTerm.f(by, scale=2.0),
... )
>>> term.name, term.coef.value.shape
('ta(x,y)', (4,))