Add --seed CLI flag for reproducible active-learning batch selection - #851
Merged
Markadrian6399 merged 2 commits intoSep 1, 2026
Merged
Conversation
…ction Add a --seed CLI flag to scripts/run_active_learning.py so contributors can reproduce a specific active-learning batch selection exactly when debugging a reported issue. The seed is forwarded to query strategies; BADGE (the randomised k-means++ strategy) now accepts a seed kwarg and threads it through _kmeans_pp_indices, defaulting to the previous hardcoded seed (42) when none is supplied to preserve existing behaviour.
|
@Bokky73 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #759
Summary
The active-learning query strategies (
detection/active_learning/query_strategies.py) involve randomness (e.g. BADGE's k-means++ seeding, and tie-breaking among equally-informative wallets), so a hardcoded or unexposed seed makes a specific batch selection impossible to reproduce when debugging a reported issue.This PR exposes a
--seedCLI flag onscripts/run_active_learning.pyso a contributor can reproduce a specific batch selection exactly.Changes
--seedargument toscripts/run_active_learning.py.BADGE.selectnow accepts aseedkwarg, threaded through_kmeans_pp_indices._kmeans_pp_indicesdefaults to the previous hardcoded seed (42) when none is supplied, preserving existing behaviour.--seedis passed to one that ignores it.Testing
No behaviour change when
--seedis omitted; existing tests are preserved.