in Uncategorized

Classification Report do Scikit-Learn em Dataframe

Não sei se só eu tinha esse problema, mas eu encontrei essa solução no Stack Overflow.

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
Resultado final.

Write a Comment

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.