sklearn.preprocessing.label_binarize()

sklearn.preprocessing.label_binarize

sklearn.preprocessing.label_binarize(y, classes, neg_label=0, pos_label=1, sparse_output=False) [source]

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.

This function makes it possible to compute this transformation for a fixed set of class labels known ahead of time.

登录查看完整内容