class sakkara.model.f_(fct: Callable, output_group: str | Tuple[str, ...] | None = None)#

Wraps a generic function with associated Sakkara components. After wrapped with this, inputs can be a subclass of ModelComponent or any other type (which will be wrapped with UnrepeatableComponent)

Example

import pymc as pm
from sakkara.model import DistributionComponent as DC, f

def g(a,b):
    return a + b

comp = DC(pm.Normal)
# Wrap g with f, pass arguments as we would have done directly to g
res = f(g)(comp, 100)
# res corresponds to N(0, 1) + 100
Parameters:
  • fct – Function callable

  • output_group – Group to assume on output use if input and output shapes do not match