I'm using scikit-learn's roc_auc_score() function for a multiclass classification problem. With iris which has three labels (and another dataset), I'm getting the exact same output when I use one-vs-one and one-vs-rest. Does anyone know why this is the case? Here's my code:
from sklearn import datasets
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
iris = datasets.load_iris()
X = iris.data
y = iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, stratify=y, random_state=0)
clf = DecisionTreeClassifier(random_state=0)
clf = clf.fit(X_train, y_train)
y_pred = clf.predict_proba(X_test)
auc_ovr = roc_auc_score(y_test, y_pred, average='macro', multi_class='ovr')
auc_ovo = roc_auc_score(y_test, y_pred, average='macro', multi_class='ovo')
print(f'OVR: {auc_ovr}, OVO: {auc_ovo}')
The last line's output is:
OVR: 0.9833333333333334, OVO: 0.9833333333333334