Skip to content

Warn when imbalance handling adds validation samples#836

Open
kiwoongyoon wants to merge 1 commit into
mljar:masterfrom
kiwoongyoon:gitcontribute/20260626-163954-669562-mljar-mljar-supervised-issue-790
Open

Warn when imbalance handling adds validation samples#836
kiwoongyoon wants to merge 1 commit into
mljar:masterfrom
kiwoongyoon:gitcontribute/20260626-163954-669562-mljar-mljar-supervised-issue-790

Conversation

@kiwoongyoon

Copy link
Copy Markdown

Title: Warn when imbalance handling adds validation samples

Summary

  • Emit a UserWarning when _handle_drastic_imbalance appends duplicated samples before validation.
  • Include the number of appended samples and note that validation folds and out-of-fold predictions can include duplicated rows.
  • Extend the focused imbalance tests to cover the new warning for direct imbalance handling and AutoML.fit.

Test evidence

  • conda run -n mljar python -m pytest tests/tests_automl/test_handle_imbalance.py -q passed: 3 passed in 13.87s.
  • git diff --check passed.
  • conda run -n mljar python -m py_compile supervised/base_automl.py tests/tests_automl/test_handle_imbalance.py passed.

Risks or notes for maintainers

  • The existing upsampling behavior is unchanged; this patch only makes it visible when it happens.
  • The warning uses Python warnings.warn. If preferred, this can be adapted to the project logger in a follow-up.

@kiwoongyoon kiwoongyoon changed the title GitContribute issue #790 Warn when imbalance handling adds validation samples Jun 26, 2026
@kiwoongyoon kiwoongyoon marked this pull request as ready for review June 26, 2026 17:07
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