Skip to content

Instantly share code, notes, and snippets.

@AI-MOO
Last active March 2, 2022 17:31
Show Gist options
  • Save AI-MOO/fea29026428030c5551dcbee749f50cd to your computer and use it in GitHub Desktop.
Save AI-MOO/fea29026428030c5551dcbee749f50cd to your computer and use it in GitHub Desktop.
# استدعاء دوال لقياس أداء النموذج
from sklearn.metrics import accuracy_score, confusion_matrix, classification_report
# دالة طباعة تقرير أداء نموذج التصنيف
def print_score(clf, X_test, y_test):
pred = clf.predict(X_test)
clf_report = pd.DataFrame(classification_report(y_test, pred, output_dict=True))
print("_______________________________________________")
print(f"Accuracy Score: {accuracy_score(y_test, pred) * 100:.2f}%")
print("_______________________________________________")
print(f"CLASSIFICATION REPORT:\n{clf_report}")
print("_______________________________________________")
print(f"Confusion Matrix: \n {confusion_matrix(y_test, pred)}\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment