one_hot_encode

Converts a matrix of categorical values into a matrix of Boolean values.

Syntax

bdata = one_hot_encode(cdata)

Inputs

cdata
The categorical values.
Type: integer
Dimension: matrix

Outputs

bdata
The one hot encoded values.
Type: Boolean
Dimension: matrix

Example

Usage of apriori:

cdata = [1 2 3 4; 1 2 5 6];
bdata = one_hot_encode(cdata)

bdata = [Matrix] 2 x 6
1 1 1 1 0 0
1 1 0 0 1 1