humancompatible.detect.data_handler.features.utils module
- humancompatible.detect.data_handler.features.utils.make_feature(data: ndarray | Series, feat_name: str | None, categ_vals: list[int | str] | None, real_bounds: list[int | str] | None, ordered: bool, discrete: bool, monotone: bool, modifiable: bool) Feature[source]
Factory that creates the appropriate Feature subclass for a single column.
The returned class depends on whether the feature is categorical, binary, mixed, or continuous, and whether a predefined list of allowed categorical values is given.
- Parameters:
data – One feature column (NumPy array or pandas Series).
feat_name – Feature name (may be
None).categ_vals – Allowed categorical values.
Nonemeans continuous.real_bounds – Optional bounds for continuous/mixed features.
ordered – Whether categorical values should be treated as ordered (if applicable).
discrete – Whether a continuous feature should be treated as discrete.
monotone – Whether monotonicity constraints apply.
modifiable – Whether the feature is modifiable.
- Returns:
A
humancompatible.detect.data_handler.features.Featureinstance (one of Binary/Categorical/Contiguous/Mixed).