Challenges with ROC Curve Performance Despite Strong Model Training

29 views Asked by At

I would like to create an ROC curve using this code.

from sklearn.metrics import roc_auc_score
from sklearn import metrics
predictions=model.predict_generator(test_datagen,steps=len(test_datagen),verbose=0)
y_pred = np.argmax(predictions, axis=1)
fpr, tpr, thresholds = metrics.roc_curve(test_labels,y_pred,pos_label=2)
plt.show()
import matplotlib.pyplot as plt
plt.title('Receiver Operating Characteristic for EfficientNetB7')
plt.plot(fpr, tpr, '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()

From the beginning, I have relied on ImageDataGenerator and used fit_generator to train the classification model. The learning curve ,loss curve and Confusion matrix exhibit overall good performance, as evident from the graphs. Learning curve Loss curve

confusion matrix image However, there is a challenge concerning the ROC curve, which shows poor performance. ROC curve Could someone guide me in identifying and correcting the error in the code?

I think the code doesn't correctly handle the multi-class nature of my task. and I tried many codes

I tried to obtain this function (.predict_proba), but it didn't appear in my model."

0

There are 0 answers