Skip to content

Commit

Permalink
perf(Evaluation): call explicit categorical parsing of class names fo…
Browse files Browse the repository at this point in the history
…r omnious class names (numbers)
  • Loading branch information
muellerdo committed Jun 15, 2022
1 parent 47aff85 commit 2b9b355
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aucmedi/evaluation/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def evalby_confusion_matrix(confusion_matrix, out_path, class_names,
def evalby_barplot(metrics, out_path, class_names, suffix=None):
# Remove confusion matrix from metric dataframe
df_metrics = metrics[~metrics["metric"].isin(["TN", "FN", "FP", "TP"])]
df_metrics["class"] = pd.Categorical(df_metrics["class"])

# Plot metric results
fig = (ggplot(df_metrics, aes("class", "score", fill="class"))
Expand Down Expand Up @@ -234,7 +235,7 @@ def evalby_rocplot(fpr_list, tpr_list, out_path, class_names, suffix=None):
df_roc.rename(index=class_mapping, inplace=True)
df_roc = df_roc.reset_index()
df_roc.rename(columns={"index": "class", 0: "FPR", 1: "TPR"}, inplace=True)
if class_names is None : df_roc["class"] = pd.Categorical(df_roc["class"])
df_roc["class"] = pd.Categorical(df_roc["class"])
# Convert from object to float
df_roc["FPR"] = df_roc["FPR"].astype(float)
df_roc["TPR"] = df_roc["TPR"].astype(float)
Expand Down

0 comments on commit 2b9b355

Please sign in to comment.