sakura.utils.data_transformations.ToOnehot

class sakura.utils.data_transformations.ToOnehot

Bases: object

Callable class to convert categorical labels to one-hot encodings using sklearn.preprocessing OneHotEncoder

Useful when the loss is not compatible directly with class labels and expected to be used on Phenotype only.

Parameters:
  • sample – Input data of shape (n_samples, n_features) to determine the categories of each feature

  • sample – array-like

  • order ('auto' or a list of array-like, optional) – Expected order of categories (unique values per feature), defaults to ‘auto’, where categories are determined automatically from the input data

Returns:

Transformed one-hot encoded data

Return type:

array-like

Methods