candle.data_utils.to_categorical

Contents

candle.data_utils.to_categorical#

candle.data_utils.to_categorical(y, num_classes=None)#

Converts a class vector (integers) to binary class matrix. E.g. for use with categorical_crossentropy. :param y: class vector to be converted into a matrix

(integers from 0 to num_classes).

Parameters:

num_classes (int) – total number of classes.

Returns:

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

Return type:

numpy array