Shortcuts

LabelEncoder

class torchtime.transforms.LabelEncoder(targets: Union[Buffer, _SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[bool | int | float | complex | str | bytes]])[source]

Transformer to encode labels into [0, n_uniques - 1]. Uses pure python method for object dtype, and numpy method for all other dtypes. This transform does not support torchscript.

Parameters:
  • targets (numpy ndarray) – numpy array containing all possible labels. Since the uniques are computed intuitively

  • set. (this can simply be the targets of the training) –