From 24b7703ca8e8aa00d9938c5591b4e373b2c71e7c Mon Sep 17 00:00:00 2001 From: "Tristan F." Date: Thu, 15 Jan 2026 08:59:50 -0800 Subject: [PATCH] fix: don't have overlapping jaccard similary matrix text --- spras/analysis/ml.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spras/analysis/ml.py b/spras/analysis/ml.py index e44712a2..55abae5a 100644 --- a/spras/analysis/ml.py +++ b/spras/analysis/ml.py @@ -459,8 +459,11 @@ def jaccard_similarity_eval(summary_df: pd.DataFrame, output_file: str | PathLik ax.set_yticklabels(algorithms) plt.colorbar(cax, ax=ax) # annotate each cell with the corresponding similarity value + # where we set the precision to be lower as the number of algorithms increases + n = 2 + if len(algorithms) > 10: n = 1 for i in range(len(algorithms)): for j in range(len(algorithms)): - ax.text(j, i, f'{jaccard_matrix.values[i, j]:.2f}', ha='center', va='center', color='white') + ax.text(j, i, f'{jaccard_matrix.values[i, j]:.{n}f}', ha='center', va='center', color='white') plt.savefig(output_png, bbox_inches="tight", dpi=DPI) plt.close()