Skip to content

preprocessor

OneHotEncoder

A class that can format data. This class provides ways to transform data's classification label into vector.

Attributes
  • data: The input data

  • n_classes: The number of classes in the classification problem.

  • labels: The number of labels.

  • label_to_vec: Mapping from label to vector.

  • int_to_label: Mapping from int to label.

init

Initialize a OneHotEncoder

fit

Create mapping from label to vector, and vector to label.

transform

Get vector for every element in the data array.

inverse_transform

Get label for every element in data.

DataTransformer

A superclass for all the DataTransformer.

transform_train

Transform the training data and get the DataLoader class.

Args
  • data: x.

  • targets: y.

  • batch_size: the batch size.

Returns
  • dataloader: A torch.DataLoader class to represent the transformed data.

transform_test

Transform the training data and get the DataLoader class.

Args
  • data: x.

  • targets: y.

  • batch_size: the batch size.

Returns
  • dataloader: A torch.DataLoader class to represent the transformed data.