multilabel(機械学習用語)
https://scikit-learn.org/stable/glossary.html#term-multilabel
scikit-learnの用語集より
A multiclass multioutput target where each output is binary.
各出力が2値のmulticlass multioutputな目的変数
binary(2値)
陽性: 1
陰性: 0 / -1
表現は dense / sparse 両方ありうる
目的変数について、type_of_target が ‘multilabel-indicator’ を返す
https://scikit-learn.org/stable/modules/generated/sklearn.utils.multiclass.type_of_target.html#sklearn.utils.multiclass.type_of_target
an array of two dimensions with at least two columns, and at most 2 unique values.
multilabel-indicator is more specific but compatible with multiclass-multioutput.
is_multilabel でも判定できる
https://scikit-learn.org/stable/modules/generated/sklearn.utils.multiclass.is_multilabel.html#sklearn.utils.multiclass.is_multilabel
code: python
>> import numpy as np
>> from sklearn.utils.multiclass import type_of_target
>> type_of_target(np.array(0, 1], [1, 1))
'multilabel-indicator'
>> # クラス1, クラス2, クラス3とすると、サンプル1はクラス2だけ、サンプル2はクラス1,2
>> type_of_target(np.array(-1, 1, -1], [1, 1, -1))
'multilabel-indicator'
preprocessing.MultiLabelBinarizer
as a utility to convert from a list of sets representation to a 2d array or sparse matrix
preprocessing.LabelBinarizer
One-hot encoding a multiclass target with preprocessing.LabelBinarizer turns it into a multilabel problem.
in multilabel classification each possible label corresponds to a binary output.
ref: output(機械学習用語)