0

I'm using input of both text and numeric data in a classification task and is interested to see the text for the instances of incorrect predictions in order to see if there is a pattern in what is incorrectly classified - is there a way of doing so?

X1_train/X1_test constitutes the text data whereas X2_train/X2_test consists of the numeric data

n_folds = 5
skf = StratifiedKFold(n_splits=n_folds, shuffle=True)
skf = skf.split(X1_train, y_train)

cv_score = []
for i, (train, test) in enumerate(skf):

    model_2 = create_model()

    print("Running Fold", i+1, "/", n_folds)
    model_2.fit([X1_train[train], X2_train[train]], y_train[train], epochs=5, batch_size=64)
    result = model_2.evaluate([X1_train[test], X2_train[test]], y_train[test])

    cv_score.append(result[1])

print(cv_score)
print("\nMean accuracy of the crossvalidation: {}".format(np.mean(cv_score)))


pred = model_2.predict([X1_test, X2_test])

???
  • Could be some problem of your data – Tayyab Vohra May 30 '20 at 22:27
  • The code runs without a problem, but I want to get the incorrect classifications – user13649783 May 31 '20 at 06:59
  • you need to get the confusion matrix? – Tayyab Vohra May 31 '20 at 12:17
  • Thanks for the response @TayyabGulsherVohra What I want to obtain is not just the number of incorrect predictions from the confusion matrix, but the text of the specific predictions that are incorrect in order to examine them. In that way I will be able to see if there is a pattern in the wrong predictions, i.e. are the texts that are incorrectly classified all very short, very long or something third. Hope it makes sense :) – user13649783 May 31 '20 at 12:43
  • https://stackoverflow.com/questions/55074681/how-to-find-the-wrong-predictions-in-keras this might help you – Tayyab Vohra May 31 '20 at 18:05

0 Answers0