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

Description Usage Arguments Details Value

View source: R/utils.R

Description

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

Usage

1
to_categorical(y, num_classes = NULL, dtype = "float32")

Arguments

y

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

num_classes

Total number of classes.

dtype

The data type expected by the input, as a string

Details

E.g. for use with loss_categorical_crossentropy().

Value

A binary matrix representation of the input.


rstudio/keras documentation built on Nov. 11, 2018, 11:25 a.m.