def gen_conf_mat(y_pred, y_true): """Generate confusion matrix with the appropriate naming conventions""" #ipdb.set_trace() inv_label_dict = { 0: 'background', 63: 'liver', 126: 'l_kidney', 189: 'r_kidney', 252: 'spleen' } #Rename columne for analysis tmp_conf_mat = ConfusionMatrix(y_true, y_pred) tmp_conf_mat = tmp_conf_mat.to_dataframe() filt_df_dict = { k: v for k, v in inv_label_dict.items() if k in tmp_conf_mat.columns.tolist() } tmp_conf_mat.rename(filt_df_dict, axis=0, inplace=True) tmp_conf_mat.rename(filt_df_dict, axis=1, inplace=True) return tmp_conf_mat