Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

to_categorical

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


Description

This function takes a vector or 1 column matrix of class labels and converts it into a matrix with p columns, one for each category. This is the format most commonly used in the fitting and predicting of neural networks.

Usage

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. Set to NULL to autodetect from the input.

Author(s)

Taylor B. Arnold, taylor.arnold@acm.org

References


kerasR

R Interface to the Keras Deep Learning Library

v0.6.1
LGPL-2
Authors
Taylor Arnold [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.