humancompatible.detect.data_handler.features.Feature module

class humancompatible.detect.data_handler.features.Feature.Feature(training_vals: ndarray | Series, name: str | None, monotone: Monotonicity = Monotonicity.NONE, modifiable: bool = True)[source]

Bases: ABC

property MAD: ndarray[float64]
abstract allowed_change(pre_val, post_val, encoded: bool) bool[source]

Checks whether value change from pre_val to post_val is allowed by mutability and similar properties

abstract decode(vals: ndarray[float64], denormalize: bool = True, return_series: bool = True, discretize: bool = False) ndarray | Series[source]

Decodes the vals into the original form

abstract encode(vals: ndarray | Series, normalize: bool = True, one_hot: bool = True) ndarray[float64][source]

Encodes the vals

abstract encoding_width(one_hot: bool) int[source]

Returns the width of the encoded values, i.e., the size in teh second dimension (axis 1)

property modifiable
property monotone
property name: str
class humancompatible.detect.data_handler.features.Feature.Monotonicity(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

DECREASING = -1
INCREASING = 1
NONE = 0