How to to get the precision, recall, confusion matrix, and f1 score? I am new in deep learning. Anyone give me a resource or help me to find the information.
Import the modules from sklearn
:
from sklearn.metrics import classification_report, confusion_matrix
Assuming your test set explanatory variables are contained in X_test
, the response variables in y_test
, and your model is named model
, predict the values for the test set:
y_pred = model.predict(X_test)
And then print the classification report and confusion matrix:
print(classification_report(y_test, y_pred))
print(confusion_matrix(y_test, y_pred))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.