CohortOperator

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 CohortOperator(*args, **kwargs)[source]

Bases: Protocol, Generic[TIn, TOut]

A computation that must observe the whole cohort at once.

Cohort-level operations cannot be parallelised across subjects and cannot be resumed per subject. Habitat model fitting and population-level feature preprocessing are the two instances in HABIT.

property spec: Spec

Return the algorithm specification.

fit(items: Sequence[TIn], **context: Any) → TOut[source]

Aggregate across subjects to produce a shared artefact.

Parameters:
  • items – Subject-level payloads in a defined order.

  • **context – Optional keyword context an implementation may accept, e.g. a habitat model fitter takes cohort= to record a non-identifiable fingerprint.

Returns:

The cohort-level artefact, e.g. a HabitatModel.

__init__(*args, **kwargs)