mirror of
https://github.com/macaodha/batdetect2.git
synced 2026-01-10 17:19:34 +01:00
Compare commits
3 Commits
2cc0bd59d4
...
65d13a32b7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65d13a32b7 | ||
|
|
31a0d1bbb5 | ||
|
|
f361420e58 |
@ -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"]]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user