'ROC curve design using both tensorflow and Scikit

I am getting error while trying to generate ROC_AUC plot. Model is trained and predicted using tensorflow (bold statement) while other part of the code from Scikit-learn. It shows the following error statement "ValueError: multilabel-indicator format is not supported" and indicating at the line "roc_curve(Y_test, preds)". The output of "probes" is as follows

[[9.2058516e-01 1.4385813e-01] [1.8307120e-02 9.5501864e-01] [9.8745126e-01 3.4884304e-02] ... [1.0000000e+00 3.5765395e-06] [9.9982500e-01 1.1690557e-03][5.1374555e-02 9.0089130e-01]]

from sklearn.metrics import roc_curve
from sklearn.metrics import auc
import matplotlib.pyplot as plt

probs = model.predict(X_test_x) #tensorflow model prediction
print(probs)
preds = probs[:,1]
fpr_keras, tpr_keras, thresholds_keras = roc_curve(Y_test, preds)
auc_keras = auc(fpr_keras, tpr_keras)

plt.title('Receiver Operating Characteristic')
plt.plot(fpr_keras, tpr_keras, 'b', label = 'AUC = %0.2f' % roc_auc)
plt.legend(loc = 'lower right')
plt.plot([0, 1], [0, 1],'r--')
plt.xlim([0, 1])
plt.ylim([0, 1])
plt.ylabel('True Positive Rate')
plt.xlabel('False Positive Rate')
plt.show()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source