humancompatible.detect.data_handler.features.Contiguous module

class humancompatible.detect.data_handler.features.Contiguous.Contiguous(training_vals: ndarray | Series, name: str | None = None, bounds: tuple[float, float] | None = None, discrete: bool = False, monotone: Monotonicity = Monotonicity.NONE, modifiable: bool = True)[source]

Bases: Feature

allowed_change(pre_val: float, post_val: float, encoded=True) bool[source]

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

property bounds: tuple[float, float]
decode(vals: ndarray[float64], denormalize: bool = True, return_series: bool = True, discretize: bool = True) ndarray | Series[source]

Decodes the vals into the original form

property discrete: bool
encode(vals: ndarray | Series, *args, **kwargs)

Encodes the vals

encoding_width(one_hot: bool) int[source]

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