To categorical (version 1.0.8.4)

**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.

Arguments

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'.

Returns

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

Raises

Value Error: If input contains string value