-
-
Save anujonthemove/92969c3eb3ef151507dfc41c28304486 to your computer and use it in GitHub Desktop.
Scikit Learn Classification Report in Dataframe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_classification_report(y_test, y_pred): | |
'''Source: https://stackoverflow.com/questions/39662398/scikit-learn-output-metrics-classification-report-into-csv-tab-delimited-format''' | |
from sklearn import metrics | |
report = metrics.classification_report(y_test, y_pred, output_dict=True) | |
df_classification_report = pd.DataFrame(report).transpose() | |
df_classification_report = df_classification_report.sort_values(by=['f1-score'], ascending=False) | |
return df_classification_report |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment