I am trying to plot ROC AUC curve of a multilable classification problem. For that I need 'y_true' and 'y_pred'. see the following code line.
fpr, tpr, tresholds = roc_curve(y_true,y_pred)
I am using keras flow_from_dataframe
and model.predict_generator
. The model.predict_generator
gives the y_pred
, but how can I get the y_true
. I have gone through simillar problems here, proposed solutions say, use test_generator.classes
or test_generator.class_indices
. But when try to use them I get this error message
AttributeError: 'DataFrameIterator' object has no attribute 'class_indices'
Please see code below.
pred=model.predict_generator(test_generator,steps=STEP_SIZE_TEST,verbose=2)
Here is the code for test_generator.
test_generator=test_datagen.flow_from_dataframe(
dataframe=validation_labels[159:],
directory="D:/data",
x_col="Path",
batch_size=1,
seed=42,
shuffle=False,
class_mode=None,
target_size=(224,224))
question from:
https://stackoverflow.com/questions/66062698/how-to-get-y-true-when-working-with-keras-flow-from-dataframe 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…