Skip to content

Instantly share code, notes, and snippets.

@AyishaR
Created January 14, 2021 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AyishaR/c0f4685e247002a498c888933972a28c to your computer and use it in GitHub Desktop.
Save AyishaR/c0f4685e247002a498c888933972a28c to your computer and use it in GitHub Desktop.
# pick random test data sample from one batch
x = random.randint(0, len(Xtest) - 1)
print("Sample:\n", test_df['Text'].to_numpy()[x], sep = "")
input = cv.transform([test_df['Text'].to_numpy()[x]]).toarray()
output = model.predict(input)
pred = np.argmax(output[0]) # finding max
print("\nPredicted: ", languages[pred]) # Picking the label from class_names based on the model output
print("Probability: ", output[0][pred])
output_true = test_df['language'].to_numpy()[x]
print("\nTrue: ", output_true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment