Skip to content

Instantly share code, notes, and snippets.

@merishnaSuwal
Created November 9, 2020 03:46
Show Gist options
  • Save merishnaSuwal/5980a84983d978b31a84b1d277eb0246 to your computer and use it in GitHub Desktop.
Save merishnaSuwal/5980a84983d978b31a84b1d277eb0246 to your computer and use it in GitHub Desktop.
# 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