📜  标签二值化器 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:48.142000             🧑  作者: Mango

代码示例2
>>> from sklearn import preprocessing
>>> lb = preprocessing.LabelBinarizer()
>>> lb.fit([1, 2, 6, 4, 2])
LabelBinarizer()
>>> lb.classes_
array([1, 2, 4, 6])
>>> lb.transform([1, 6])
array([[1, 0, 0, 0],
       [0, 0, 0, 1]])