AverageCombiner

Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.

class AverageCombiner(weights: Mapping[str, float] | None = None)[source]

Bases: object

Average sibling blocks element-wise, optionally with child weights.

The averaging counterpart of WeightedConcatCombiner: where concatenation keeps every child column, averaging collapses the children into a consensus signal – e.g. the mean of two co-registered repeats of the same sequence. All children must have the same number of columns, paired positionally.

Parameters:

weights – Weight per child source label. Weights are normalised to sum to one; children without an entry keep weight 1.0 (before normalisation).

__init__(weights: Mapping[str, float] | None = None) → None[source]
property spec: Spec

Return the algorithm specification used for provenance.

__call__(blocks: Sequence[DataFrame], *, context: Mapping[str, Any] | None = None) → DataFrame[source]

Compute the (weighted) column-wise mean across child blocks.

Parameters:
  • blocks – Child blocks in child order, all with equal column counts.

  • context – Carries the child source labels under "sources".

Returns:

One block with the averaged columns.

Raises:

HABITAPIError – If the children have different column counts.