humancompatible.detect.data_handler.features.Binary module
- class humancompatible.detect.data_handler.features.Binary.Binary(training_vals: ndarray | Series, value_names: list[int | str] | None = None, name: str | None = None, monotone: Monotonicity = Monotonicity.NONE, modifiable: bool = True)[source]
Bases:
Feature- allowed_change(pre_val: int | str, post_val: int | str, encoded=True) bool[source]
Checks whether value change from pre_val to post_val is allowed by mutability and similar properties
- decode(vals: ndarray[float64], denormalize: bool = True, return_series: bool = True, discretize: bool = False) ndarray | Series[source]
Take a flat 0/1 column (or array) and map back to the two original category values.
- 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)
- property value_mapping: dict[int | str, int]