0

I'm new to machine learning and im trying to get the ROC AUC score of my own model. The model has 14 classes. However im getting this error that say it has only one class present in y_true. enter image description here

the testing data is loaded in ImageDataGenerator. Each class has 120 images enter image description here

This is the model and data im testing

model = tf.keras.models.load_model('/content/model055530/model.h5')

test_datagen = ImageDataGenerator(rescale = 1/255.0)
test_gen = test_datagen.flow_from_directory('/content/splitdataV/test/', 
                                            batch_size=BATCH_SIZE,
                                            shuffle=False,
                                            class_mode='categorical',
                                            target_size=(IMAGE_SIZE, IMAGE_SIZE))

The code to set the images and labels

import numpy as np
from sklearn import metrics

x, y = test_gen.next()
prediction = model.predict(x)

predict_label = np.argmax(prediction, axis=-1)
true_label = np.argmax(y, axis=-1)
from sklearn.metrics import roc_auc_score
roc_auc_score(true_label,predict_label, multi_class='ovo')

I would appreciate if anyone can give me feedback about this. Thank you

drey
  • 1
  • 1
  • Does this answer your question? [roc\_auc\_score - Only one class present in y\_true](https://stackoverflow.com/questions/45139163/roc-auc-score-only-one-class-present-in-y-true) – Calimo Mar 22 '23 at 06:52

0 Answers0