Label Binarizer

../../../../_images/label_binarizer.svg

Binarize labels in a one-vs-all fashion.

Several regression and binary classification algorithms are available in the scikit. A simple way to extend these algorithms to the multi-class classification case is to use the so-called one-vs-all scheme. At learning time, this simply consists in learning one regressor or binary classifier per class. In doing so, one needs to convert multi-class labels to binary labels (belong or does not belong to the class). LabelBinarizer makes this process easy with the transform method. At prediction time, one assigns the class for which the corresponding model gave the greatest confidence. LabelBinarizer makes this easy with the inverse_transform method

Configuration:

  • pos_label

    Value with which positive labels must be encoded.

  • neg_label

    Value with which negative labels must be encoded.

Attributes:

  • classes_

    Holds the label for each class.

  • y_type_

    Represents the type of the target data as evaluated by utils.multiclass.type_of_target. Possible type are ‘continuous’, ‘continuous-multioutput’, ‘binary’, ‘multiclass’, ‘multiclass-multioutput’, ‘multilabel-indicator’, and ‘unknown’.

Input ports:

Output ports:
model : model
Model
pos_label (pos_label)
Value with which positive labels must be encoded.
neg_label (neg_label)
Value with which negative labels must be encoded.

Some of the docstrings for this module have been automatically extracted from the scikit-learn library and are covered by their respective licenses.

class node_preprocessing.LabelBinarizer[source]