PooledUnits
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 PooledUnits(frame: DataFrame, subject_ids: Tuple[str, ...], boundaries: Tuple[Tuple[int, int], ...])[source]
Bases:
objectThe fan-in product: one cohort matrix plus its subject index.
- frame
Pooled unit-by-feature matrix with a positional index, in cohort order. Stored (rather than derived) so cohort-level consumers see the exact frame the per-subject units provided, dtypes included.
- Type:
pandas.core.frame.DataFrame
- boundaries
(start, stop)row range of each subject’s block insideframe;subject_ids[i]ownsframe.iloc[start:stop].
- fan_out(values: ndarray) Dict[str, ndarray][source]
Split a cohort-length vector back into per-subject pieces.
This is the numerical core of the fan-out movement: any quantity computed row-wise on the pooled matrix (cluster labels, distances, quality scores) returns to its subjects through the same index the fan-in recorded.
- Parameters:
values – Array whose first axis has one entry per pooled row.
- Returns:
Mapping of subject id to that subject’s slice of
values, in cohort order.- Raises:
HABITAPIError – If
valuesdoes not have one entry per row.