Skip to content

Commit

Permalink
classification_report
Browse files Browse the repository at this point in the history
  • Loading branch information
wassname committed Oct 13, 2020
1 parent 321c181 commit 7435a24
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions deep_ml_curriculum/classification_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pandas as pd
import sklearn.metrics
import numpy as np

def pd_classification_report(*args, **kwargs):
out_df = pd.DataFrame(sklearn.metrics.classification_report(*args, **kwargs, output_dict=True)).T
# Order cols
out_df[["precision","recall","f1-score","support"]]
# Round
out_df[["precision","recall","f1-score"]]= out_df[["precision","recall","f1-score"]].apply(lambda x: round(x,2))
out_df[["support"]]= out_df[["support"]].apply(lambda x: x.astype(np.int))
return out_df

0 comments on commit 7435a24

Please sign in to comment.