# Binary encoding

Binary encoding can be used to encode features that contain exactly two classes, for example, 0/1, or positive/negative, or on/off.

The Binary encoding allows you to evaluate your model with specific tools, like the Threshold slider and the ROC Curve.

## Positive class

The Positive class lets you select the particular class that is considered positive.

The positive class is given the numerical value 1 in the model, or True in the predictions table.
The other class is given the value 0, or False.

Example:

The Movie review feelings tutorial classifies written reviews as positive or negative.
To answer the question "Was the viewer happy about the movie?", you can set the positive sentiment as the Positive class. Examples in your dataset will be considered positive if they are identified as belonging to the positive class.

## When to use binary encoding

### Multi-label classification

If you’re working with multi-label classification all target features must use binary encoding. This is because an example in multi-label classification can belong to or not belong to a class, that is, binary.

Example
In the tutorial Build your own music critic all image label is a binary encoded feature. The song can be both energetic and happy.

### When you only have 2 classes

Use binary encoding when a feature is categorical but has only two classes.

By using binary encoding instead of categorical encoding, you will be able to use the predictions inspection to vary the threshold that separates whether an example falls in the Positive class or not, and to look at the ROC curve.

Was this page helpful?