binarize

Binarizes the input records so that all the values of the input are either 0 or 1.

Syntax

[binarized_data, parameters] = binarize(X, threshold)

Inputs

X
Input data to be binarized.
Type: double
Dimension: matrix
threshold
Threshold value above which are changed to 1 and below are changed to 0.
Type: double
Dimension: scalar

Outputs

binarized_data
Binarized input records.
Type: integer
Dimension: matrix
parameters
Struct containing values required by binarizeTransform function used on test data.
threshold: threshold value used for binarization on training data.
Type: double | integer
Dimension: struct

Example

Usage of binarize

X = [1 2 3;
     0 -1 2;
     4 5 6];

[binarized_data, parameters] = binarize(X, 1)
> binarized_data
binarized_data = [Matrix] 3 x 3
0 1 1
0 0 1
1 1 1
> parameters
parameters = struct [
threshold: 1
]

Comments

Output 'parameters' can be used by binarizetransform function.