Skip to content

v2.2.0 WoE Stability: Class Count Constraint Enforcement

Latest

Choose a tag to compare

@ChenTaHung ChenTaHung released this 19 Feb 01:13
358c0dc

[2.2.0] - 2026-02-18

Added

  • min_negatives parameter in BinningConstraints for controlling minimum negative samples (y=0) per bin, ensuring stable WoE calculations
  • positives and negatives properties on Block class for easier access to class counts in binary classification
  • Feasibility warnings during resolve() when min_positives or min_negatives constraints cannot be mathematically satisfied with the given min_bins
  • _enforce_min_class_counts() function for unified enforcement of both min_positives and min_negatives constraints in a single pass
  • New tests for class count constraint enforcement and feasibility warnings

Fixed

  • min_positives constraint is now actively enforced - Previously it was only a soft penalty (1.4x score multiplier) in the merge scorer; now bins violating min_positives are actively merged until the constraint is satisfied or min_bins floor is reached
  • _validate_merge_result() now properly checks and warns about min_positives and min_negatives violations when constraints cannot be fully satisfied

Changed

  • merge_adjacent() now includes Phase 3 for class count enforcement after min_samples enforcement
  • _validate_merge_result() now accepts is_binary_y parameter to enable class count validation
  • Block.as_dict() now includes positives and negatives keys in the exported dictionary
  • MergeScorer._apply_penalties() now applies bonuses for merging bins with insufficient negatives (matching existing positives behavior)
  • BinningConstraints.__repr__() now includes min_negatives in the string representation
  • BinningConstraints.copy() now properly copies min_negatives parameter