WeightedConcatCombiner

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 WeightedConcatCombiner(weights: Mapping[str, float] | None = None)[source]

Bases: object

Concatenate sibling blocks after scaling each by a child-specific weight.

Modalities with different intensity scales (e.g. CT in Hounsfield units next to a normalised MR sequence) distort distance-based clustering: the louder modality dominates purely through units. Scaling each child block before the merge is the explicit, specifiable answer – the weight is part of the specification and lands in the model fingerprint.

Parameters:

weights – Scale factor per child, keyed by the child’s source label (its as_ alias when set, else its modality). Children without an entry keep weight 1.0.

__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]

Scale each child block by its weight and concatenate.

Parameters:
  • blocks – Child blocks in child order.

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

Returns:

The merged block of weighted child columns.