class sakkara.model.FunctionComponent(fct: Callable[[Any, ...], Any], output_group: Tuple[str] | None, *args: ModelComponent, **kwargs: ModelComponent)#

Class for intermediate states of mathematical operations between components. This class is intended for internal usage, to use a generic function in your model see sakkara.model.f_()

Parameters:
  • fct – Function to evaluate

  • **kwargs – See below

Arguments:
  • arg (ModelComponent) – Arguments passed to fct. If object does not inherit ModelComponent, you may wrap it with sakkara.model.UnrepeatableComponent

Keyword Arguments:
  • kwarg (ModelComponent) – Keyword argument passed to fct. If object does not inherit ModelComponent, you may wrap it with sakkara.model.UnrepeatableComponent

build_representation(groupset: GroupSet) None#

Build the group of this component, performed after prebuild.

Parameters:

groupset – Groups to be used for building all components of the model.

build_variable() None#

Build the variable, performed after prebuild and build_group.

clear()#

Clear variable and group for this and underlying components

prebuild(groupset: GroupSet) None#

All operations to be performed before building group and variable, e.g., building the underlying components.

Parameters:

groupset – Groups to be used for building all components of the model.

retrieve_groups() Set[str]#

Retrieve group names for this and underlying components

to_minibatch(batch_size: int, group: str) ModelComponent#

Convert the component to counterpart suitable for mini-batches