[MNT] remove imbalanced-learn test dependency and raise imbalance coverage - #3671
[MNT] remove imbalanced-learn test dependency and raise imbalance coverage#3671TonyBagnall wants to merge 4 commits into
Conversation
…erage Address part of #3654. The SMOTE and ADASYN tests used imbalanced-learn as a runtime parity oracle behind a soft-dependency skip. Replace the skipped equivalence tests with hardcoded reference values captured from imblearn 0.14.2 (SMOTE k_neighbors=1 / ADASYN n_neighbors=1, random_state=49); this port reproduces them bit-identically, so the whole suite now passes with imbalanced-learn uninstalled. Raise imbalance package coverage from 89% to 99% with functional tests: multi-class skip of already-balanced classes, ADASYN RuntimeError (no majority neighbours) and ValueError (rounding yields no samples), ESMOTE determinism, and OHIT single-sample-minority tiling and no-cluster fallback. Remove genuinely dead code rather than test it: the Borderline-SMOTE-2 y-weighting branch in SMOTE._generate_samples (never called; _make_samples always passes y=None) and the return_bias branch in ESMOTE (always called with return_bias=False). Remaining uncovered: OHIT noise-point/zero-density branches, reachable only via contrived seed-fragile cluster geometries, and SMOTE _get_test_params, covered by the global estimator conformance suite. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Thank you for contributing to
|
RedComets no longer uses imbalanced-learn (its oversampling now runs through aeon's own SMOTE and RandomOverSampler), so drop the dependency entirely: - remove "imbalanced-learn" from the all_extras optional dependencies in pyproject.toml; - sever the two remaining test-time imblearn parity oracles. The RandomOverSampler imblearn-match test is replaced by a multi-class balancing test (its behaviour was already covered by the balance/originals/multivariate tests), and the RedComets SMOTE oracle test becomes an imblearn-free wiring test asserting the oversampling balances classes and preserves the original normalised cases. SMOTE's numerical parity with imblearn is locked separately by the hardcoded reference test in the imbalance package. The imbalance and RedComets suites now pass with imbalanced-learn uninstalled. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address part of #3654.
After #3669 I will update this to remove the soft dependency, #3669 to go in first.
The SMOTE and ADASYN tests used imbalanced-learn as a runtime parity oracle behind a soft-dependency skip. Replace the skipped equivalence tests with hardcoded reference values captured from imblearn 0.14.2 (SMOTE k_neighbors=1 / ADASYN n_neighbors=1, random_state=49); this port reproduces them bit-identically, so the whole suite now passes with imbalanced-learn uninstalled.
While we are Raise imbalance package coverage from 89% to 99% with functional tests: multi-class skip of already-balanced classes, ADASYN RuntimeError (no majority neighbours) and ValueError (rounding yields no samples), ESMOTE determinism, and OHIT single-sample-minority tiling and no-cluster fallback.
Remove genuinely dead code rather than test it: the Borderline-SMOTE-2 y-weighting branch in SMOTE._generate_samples (never called; _make_samples always passes y=None) and the return_bias branch in ESMOTE (always called with return_bias=False).
For all contributions
For new estimators and functions
__maintainer__at the top of relevant files and want to be contacted regarding its maintenance. Unmaintained files may be removed. This is for the full file, and you should not add yourself if you are just making minor changes or do not want to help maintain its contents.For developers with write access