ftag.labeller#
Classes#
Defines a labelling scheme. |
Module Contents#
- class ftag.labeller.Labeller#
Defines a labelling scheme.
Classes are assigned integer labels in [0, …, n] based on pre-defined selections.
- labels#
The labels to be use.
- Type:
LabelContainer | list[str | Label]
- require_labels#
Whether to require that all objects are labelled.
- Type:
bool
- labels: ftag.labels.LabelContainer | list[str | ftag.labels.Label]#
- require_labels: bool = True#
- __post_init__() None #
- property variables: list[str]#
Returns the variables used for labelling.
- Returns:
The variables used for labelling.
- Return type:
list[str]
- get_labels(array: numpy.ndarray) numpy.ndarray #
Returns the labels for the given array.
- Parameters:
array (np.ndarray) – The array to label.
- Returns:
The labels for the given array.
- Return type:
np.ndarray
- Raises:
ValueError – If the
require_labels
attribute is set toTrue
and some objects were not labelled.
- add_labels(array: numpy.ndarray, label_name: str = 'labels') numpy.ndarray #
Adds the labels to the given array.
- Parameters:
array (np.ndarray) – The array to label.
label_name (str) – The name of the label column.
- Returns:
The array with the labels added.
- Return type:
np.ndarray
- Raises:
ValueError – If the
require_labels
attribute is set toFalse
.