Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Get the loss and accuracy of the model by evaluation
loss, acc = model.evaluate(X_test, y_test)
# Print the loss and accuracy score for the model
print("%s: %.2f%%" % (model.metrics_names[0], loss*100))
print("%s: %.2f%%" % (model.metrics_names[1], acc*100))
# Predicting the output predictions
y_pred = model.predict(X_test).round()
# Calculating the F1 score, recall, and precision
print("%s: %.2f%%" % ("F1-score", f1_score(y_test, y_pred)*100))
print("%s: %.2f%%" % ("Recall", recall_score(y_test, y_pred)*100))
print("%s: %.2f%%" % ("Precision", precision_score(y_test, y_pred)*100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment