Skip to content

Standardize _get_scores() return type across all query strategies#197

Open
CoolJosh0221 wants to merge 1 commit intontucllab:masterfrom
CoolJosh0221:master
Open

Standardize _get_scores() return type across all query strategies#197
CoolJosh0221 wants to merge 1 commit intontucllab:masterfrom
CoolJosh0221:master

Conversation

@CoolJosh0221
Copy link
Contributor

Standardize _get_scores() to return (np.ndarray, np.ndarray) across all strategies

Motivation

_get_scores() had inconsistent return types across strategies — zip iterators, list(zip(...)), or not implemented at all. This blocks future plans for supporting batch-mode querying and ALBL soft-advice vectors, which need a uniform interface to consume scores from any strategy.

Note: "Soft-advice vectors" = continuous score distributions over the unlabeled pool (vs. the current one-hot hard advice from make_query()), enabling smoother blending in ALBL's Exp4.P bandit.

Changes

Every _get_scores() now returns (entry_ids: np.ndarray, scores: np.ndarray) where higher = more informative. Empty pools return (empty_int_array, empty_float_array). The base class default raises NotImplementedError.

  • 6 strategies updated to new return format (US, BALD, CoreSet, EpsilonUS, InformationDensity, DensityWeightedMeta)
  • 3 strategies added new _get_scores() implementations (QBC, QUIRE, RandomSampling)
  • 1 strategy extracted scores from C extension (HintSVM)
  • 2 strategies raise NotImplementedError (VarianceReduction, ALBL)

Backward compatibility

No public API changes. make_query() still returns int. return_score=True still returns (ask_id, list(zip(...))).

Tests

24 new contract tests in test_get_scores.py covering return types, empty pools, and return_score compatibility. 3 existing test files updated for the new tuple format. 90/90 pass (11 pre-existing sklearn 1.8 multi_class failures are unrelated).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant