Galaxy | Tool Preview

To categorical (version

What it does

Converts a class vector (integers) to binary class matrix.

tf.keras.utils.to_categorical( y, num_classes=None, dtype='float32' )

E.g. for use with categorical_crossentropy.


y: a vector of numbers to be converted into a matrix of one-hot encoded values. num_classes: total number of classes. If None, this would be inferred as the (largest number in y) + 1. dtype: The data type expected by the input. Default: 'float32'.


A binary matrix representation of the input. The classes axis is placed last.


Value Error: If input contains string value