HabitatAssigner
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 HabitatAssigner(*args, **kwargs)[source]
Bases:
ProtocolAssign habitat labels to one subject using a fitted model.
Keeping this separate from the fitter is what enforces train/predict consistency structurally rather than by convention: prediction has no way to re-learn anything, because everything it needs is inside the model.
The model is supplied to the CONSTRUCTOR, not to the call. Two consequences follow: the assigner becomes an ordinary one-argument callable (a subject-level operator like every other step), and an assigner cannot be constructed without a fitted model, so “predicting before fitting” becomes unrepresentable.
- property model: HabitatModel
Return the fitted habitat definition this assigner projects.
- __call__(supervoxel_map: Supervoxelization) HabitatMap[source]
Project the fitted habitat definition onto one subject.
- Parameters:
supervoxel_map – Supervoxelization of the subject to label.
- Returns:
The subject’s habitat label image, tagged with the model’s id.
- Raises:
CompatibilityError – If the supervoxel features do not provide the feature names the model requires.
- __init__(*args, **kwargs)