Skip to content

Extend the #854 deprecation shim to the remaining public treatment-before-y methods #981

Description

@jeongyoonlee

Part of #980 (v1.0 M1). Refs #854.

#975 added a FutureWarning when treatment/y are passed positionally, wired into fit, fit_predict, estimate_ate and predict via SHIMMED_METHODS in causalml/inference/_arg_order.py.

That covers the four method names. Eleven other public methods take treatment before y and get no warning at all:

causalml/inference/meta/base.py        BaseLearner.bootstrap(X, treatment, y, p, size, rng)
causalml/inference/meta/base.py        BaseLearner.fit_bootstrap_ensemble(X, treatment, y, p, …)
causalml/inference/meta/drlearner.py   BaseDRLearner.bootstrap(X, treatment, y, p, size, …)
causalml/inference/iv/drivlearner.py   BaseDRIVLearner.bootstrap(X, assignment, treatment, y, p, …)
causalml/inference/tree/causal/causaltree.py  CausalTreeRegressor.bootstrap(X, treatment, y, sample_size, seed)
causalml/inference/tree/causal/causaltree.py  CausalTreeRegressor.bootstrap_pool(X, treatment, y, n_bootstraps, …)
causalml/inference/tree/_uplift/uplifttree.py _KernelUpliftTreeClassifier.prune(X, treatment, y, minGain, rule, …)
causalml/inference/tree/_uplift/uplifttree.py UpliftTreeClassifier.fill(X, treatment, y)
causalml/metrics/sensitivity.py        Sensitivity.get_prediction(X, p, treatment, y, …)
causalml/metrics/sensitivity.py        Sensitivity.get_ate_ci(X, p, treatment, y, …)
causalml/metrics/sensitivity.py        Sensitivity.get_potential_outcome_predictions(X, p, treatment, y, …)

This has to be decided before the warning release ships, not with the flip. A deprecation window is one-shot: any method whose positional order changes at v1.0 must warn in the same release, or it needs a second cycle of its own.

Scope

Two defensible outcomes; the issue is to pick one and make it explicit:

  1. Extend the shim. Add these names to SHIMMED_METHODS, or decorate them individually. The shim is already signature-driven, so v1_order() derives each target correctly with no special-casing — including BaseDRIVLearner.bootstrap's assignment and the Sensitivity methods' p-second shape.
  2. Declare them out of scope, keep their current order at v1.0, and say so in the migration guide. Defensible for prune/fill (tree-internal) and the Sensitivity helpers (evaluation-side), much less so for the bootstrap family, which is public API on the most-used learners.

Note the Sensitivity methods are a third argument shape — (X, p, treatment, y) — so including them also answers open question 2 on the epic.

Acceptance

  • Each of the 11 methods is either shimmed or listed in the migration guide as intentionally unchanged.
  • test_every_treatment_y_method_is_shimmed in tests/test_fit_arg_order.py is widened past SHIMMED_METHODS so it guards whichever set is chosen — today it only scans those four names, which is why this gap wasn't caught.

Activity

  1. added a commit that references this issue on Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions