LabelDecoder

class falcon.tabular.processors.LabelDecoder

Label encoder/decoder to be used for encoding labels as integers and vice versa.

__init__() None

does not take any arguments

fit(X: ndarray[Any, dtype[ScalarType]], y: Optional[Any] = None, *args: Any, **kwargs: Any) None

Fits the decoder.

Parameters
  • X (npt.NDArray) – labels to be encoded as integers

  • y (Any, optional) – dummy argument, by default None

fit_pipe(X: Any, y: Any, *args: Any, **kwargs: Any) None

Since label decoder should initially be fitted and applied before the main training phase of pipeline, this method does nothing.

Parameters
  • X (Any) – dummy argument

  • y (Any) – dummy argument

forward(X: ndarray[Any, dtype[ScalarType]], *args: Any, **kwargs: Any) ndarray[Any, dtype[ScalarType]]

Equivalent to .transform(X, inverse=True).

Parameters

X (npt.NDArray) – labels to decode

Returns

labels decoded to strings

Return type

npt.NDArray

get_input_type() Type
Returns

Int64Array

Return type

Type

get_output_type() Type
Returns

NDArray[str]

Return type

Type

predict(X: ndarray[Any, dtype[ScalarType]], inverse: bool = True, *args: Any, **kwargs: Any) ndarray[Any, dtype[ScalarType]]

Equivalent of .transform().

Parameters
  • X (npt.NDArray) – labels

  • inverse (bool, optional) – if True, encode strings as integers, else convert integers back to strings, by default True

Returns

encoded/decoded labels

Return type

npt.NDArray

to_onnx() SerializedModelRepr

Serializes the encoder to onnx.

Return type

SerializedModelRepr

transform(X: ndarray[Any, dtype[ScalarType]], inverse: bool = True, *args: Any, **kwargs: Any) ndarray[Any, dtype[ScalarType]]

Encodes/decodes the labels.

Parameters
  • X (npt.NDArray) – labels

  • inverse (bool, optional) – if True, encode strings as integers, else convert integers back to strings, by default True

Returns

encoded/decoded labels

Return type

npt.NDArray