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

to_categorical(y, num_classes = NULL)

Arguments

y

Class vector to be converted into a matrix (integers from 0 to num_classes).

num_classes

Total number of classes.

Value

A binary matrix representation of the input.

Details

E.g. for use with loss_categorical_crossentropy().