squlearn.util.optree.OpTreeSum

class squlearn.util.optree.OpTreeSum(children_list: None | List[OpTreeElementBase] = None, factor_list: None | List[float] = None, operation_list: None | List[Callable] | List[None] = None)

A OpTree node that sums over its children.

Parameters:
  • children_list (list) – A list of children of the summation.

  • factor_list (list) – A list of factors for each child.

  • operation_list (list) – A list of operations that are applied to each child.

append(children: OpTreeElementBase, factor: float = 1.0, operation: None | Callable = None)

Appends a child to the node.

Parameters:
  • children (OpTreeElementBase) – The child to be appended.

  • factor (float, optional) – The factor that is applied to the child. Defaults to 1.0.

  • operation ([type], optional) – The operation that is applied to the child. Defaults to None.

copy()

Function for copying a OpTreeNodeBase object.

remove(index: List[int] | int)

Removes children from the node.

Parameters:

index (int) – The list of indices of the children to be removed. Can also be a single index.