Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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