diff --git a/deep_ml_curriculum/classification_report.py b/deep_ml_curriculum/classification_report.py new file mode 100644 index 0000000..aec0898 --- /dev/null +++ b/deep_ml_curriculum/classification_report.py @@ -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