Skip to content

Fix seed parameter TypeError in BaseDRLearner bootstrap CI (#857)#879

Open
mohsinm-dev wants to merge 1 commit intouber:masterfrom
mohsinm-dev:fix/857-drlearner-bootstrap-seed
Open

Fix seed parameter TypeError in BaseDRLearner bootstrap CI (#857)#879
mohsinm-dev wants to merge 1 commit intouber:masterfrom
mohsinm-dev:fix/857-drlearner-bootstrap-seed

Conversation

@mohsinm-dev
Copy link
Contributor

Fixes #857

BaseDRLearner.estimate_ate() passed seed=seed to self.bootstrap(), which doesn't accept that parameter — raising TypeError whenever bootstrap_ci=True.

Changes:

  • Remove stray seed=seed from bootstrap call
  • Add local RNG seeding so seed controls bootstrap reproducibility without mutating global numpy state
  • Override bootstrap() in BaseDRLearner to pass per-iteration seeds into fit() for deterministic cross-fitting
  • Apply same fix to fit_predict(return_ci=True) path

Tests:

  • Regression test confirming no TypeError
  • Reproducibility check (same seed → identical CI bounds)
  • Global RNG state preservation check

Remove stray seed=seed argument passed to bootstrap() which did not
accept it, causing TypeError when bootstrap_ci=True.

Add local RNG-based seeding for reproducible bootstrap CI in both
estimate_ate() and fit_predict() without mutating global numpy state.
Override bootstrap() in BaseDRLearner to thread per-iteration seeds
into fit() for deterministic cross-fitting.
bootstrap_ci=True,
n_bootstraps=10,
bootstrap_size=200,
seed=42,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use from .const import RANDOM_SEED instead.

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.

seed parameter where it is not requested

2 participants