Compare commits

...

3 Commits

Author SHA1 Message Date
mbsantiago
65d13a32b7 Also ignore assertion errors in gallery plotting 2025-08-11 09:46:36 +01:00
mbsantiago
31a0d1bbb5 Drop duplicate bin edges 2025-08-11 08:59:12 +01:00
mbsantiago
f361420e58 Fix issue in gallery plotting 2025-08-11 08:54:37 +01:00

View File

@ -100,7 +100,7 @@ def plot_class_examples(
preprocessor=preprocessor,
duration=duration,
)
except ValueError:
except (ValueError, AssertionError):
continue
for index, match in enumerate(false_positives[:n_examples]):
@ -112,7 +112,7 @@ def plot_class_examples(
preprocessor=preprocessor,
duration=duration,
)
except ValueError:
except (ValueError, AssertionError):
continue
for index, match in enumerate(false_negatives[:n_examples]):
@ -124,11 +124,11 @@ def plot_class_examples(
preprocessor=preprocessor,
duration=duration,
)
except ValueError:
except (ValueError, AssertionError):
continue
for index, match in enumerate(cross_triggers[:n_examples]):
ax = plt.subplot(4, n_examples, 4 * n_examples + index + 1)
ax = plt.subplot(4, n_examples, 3 * n_examples + index + 1)
try:
plotting.plot_cross_trigger_match(
match,
@ -136,7 +136,7 @@ def plot_class_examples(
preprocessor=preprocessor,
duration=duration,
)
except ValueError:
except (ValueError, AssertionError):
continue
return fig
@ -154,7 +154,7 @@ def get_binned_sample(matches: List[MatchEvaluation], n_examples: int = 5):
]
)
bins = pd.qcut(pred_scores, q=n_examples, labels=False)
bins = pd.qcut(pred_scores, q=n_examples, labels=False, duplicates="drop")
df = pd.DataFrame({"indices": indices, "bins": bins})
sample = df.groupby("bins").apply(lambda x: x.sample(1))
return [matches[ind] for ind in sample["indices"]]