GmmHabitatModelFitter

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 GmmHabitatModelFitter(n_habitats: int | None = None, min_habitats: int = 2, max_habitats: int = 10, validation: str | Sequence[str] = 'bic', covariance_type: str = 'full', n_init: int = 50, max_iter: int = 100)[source]

Bases: object

Learn population habitats by a Gaussian mixture over pooled features.

Probabilistic counterpart of the k-means fitter: habitat membership is a posterior distribution, and model selection uses an information criterion. The model stores the mixture means as centroids; soft assignment can be added by a dedicated assigner without changing the model artefact.

The fitter is Seedable; the seed is applied to mixture initialisation at fit time.

Parameters:
  • n_habitats – Fixed habitat count, or None to select it by validation.

  • min_habitats – Smallest candidate count during selection.

  • max_habitats – Largest candidate count during selection.

  • validation – Selection criterion, or a list of criteria that each cast one vote: "bic" / "aic" / "davies_bouldin" (minimise), "bic_elbow" (Prior 2024 BIC-slope elbow, not minimum BIC), or "silhouette" / "calinski_harabasz" / "gap" (maximise).

  • covariance_type – GaussianMixture covariance structure.

  • n_init – Number of mixture initialisations per candidate count; the best-likelihood run is kept (sklearn n_init).

  • max_iter – EM iteration limit per candidate count.

__init__(n_habitats: int | None = None, min_habitats: int = 2, max_habitats: int = 10, validation: str | Sequence[str] = 'bic', covariance_type: str = 'full', n_init: int = 50, max_iter: int = 100) → None[source]
property spec: Spec

Return the algorithm specification.

set_random_state(seed: int) → None[source]

Set the seed applied to mixture initialisation at fit time.

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.

  • cohort – Cohort the units came from, fingerprinted into the model.

Returns:

A self-contained habitat model applicable to unseen subjects.