HabitatModelFitter

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

Bases: Protocol

Fit the population-level habitat definition. THIS IS THE COHORT-LEVEL STEP.

This is the only place in HABIT where information crosses subject boundaries, and it is what makes habitat labels comparable between patients and between cohorts. Its output, HabitatModel, is the artefact a study should publish so that other groups can reproduce the same habitat definition on their own data.

Named *Fitter (lifelines / statsmodels convention), NOT *Estimator: sklearn reserves “estimator” for objects whose fit returns self and that are clone()-able, whereas this fit returns a NEW HabitatModel artefact.

property spec: Spec

Return the algorithm specification.

fit(units: Sequence[Supervoxelization], *, cohort: Cohort | None = None) → HabitatModel[source]

Learn the shared habitat definition from all subjects.

Parameters:
  • units – Supervoxelizations in a defined, reproducible order. Order is part of the contract because clustering can be order-sensitive.

  • cohort – Cohort the units came from, used only to record a non-identifiable fingerprint inside the model.

Returns:

A self-contained habitat model applicable to unseen subjects.

__init__(*args, **kwargs)