github facebookresearch/balance 0.14.0
0.14.0 (2025-12-14)

2 days ago

New Features

  • Enhanced adjusted sample summary output
    • Sample.__str__() now displays adjustment details (method, trimming
      parameters, design effect, effective sample size) when printing adjusted
      samples (#194,
      #57).
  • Richer Sample.summary() diagnostics
    • Adjusted sample summary now groups covariate diagnostics, reports design
      effect alongside ESSP/ESS, and surfaces weighted outcome means when
      available.
  • Warning of high-cardinality categorical features in .adjust()
    • Categorical features where ≥80% of values are unique are flagged before
      weight fitting to help identify problematic columns like user IDs
      (#195,
      #65).
  • Ignored column handling for Sample inputs
    • Sample.from_frame accepts ignore_columns for columns that should remain
      on the dataframe but be excluded from covariates and outcome statistics.
      Ignored columns appear in Sample.df and can be retrieved via
      Sample.ignored_columns().

Code Quality & Refactoring

  • Consolidated diagnostics helpers
    • Added _concat_metric_val_var() helper and balance.util._coerce_scalar
      for robust diagnostics row construction and scalar-to-float conversion.
    • Breaking change: Sample.diagnostics() for IPW now always emits
      iteration/intercept summaries plus hyperparameter settings.

Bug Fixes

  • Early validation of null weight inputs
    • Sample.from_frame now raises ValueError when weights contain None,
      NaN, or pd.NA values with count and preview of affected rows.
  • Percentile weight trimming across platforms
    • trim_weights() now computes thresholds via percentile quantiles with
      explicit clipping bounds for consistent behavior across Python/NumPy
      versions.
    • Breaking change: percentile-based clipping may shift by roughly one
      observation at typical limits.
  • IPW diagnostics improvements
    • Fixed multi_class reporting, normalized scalar hyperparameters to floats,
      removed deprecated penalty argument warnings, and deduplicated metric
      entries for stable counts across sklearn versions.

Tests

  • Added Windows and macOS CI testing support
    • Expanded GitHub Actions to run on ubuntu-latest, macos-latest, and
      windows-latest for Python 3.9-3.14.
    • Added tempfile_path() context manager for cross-platform temp file
      handling and configured matplotlib Agg backend via conftest.py.

Contributors

@neuralsorcerer, @talgalili, @wesleytlee

Full Changelog

0.13.0...0.14.0

Don't miss a new balance release

NewReleases is sending notifications on new releases.