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:
- 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.
- 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.
Part of #980 (v1.0 M1). Refs #854.
#975 added a
FutureWarningwhentreatment/yare passed positionally, wired intofit,fit_predict,estimate_ateandpredictviaSHIMMED_METHODSincausalml/inference/_arg_order.py.That covers the four method names. Eleven other public methods take
treatmentbeforeyand get no warning at all: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:
SHIMMED_METHODS, or decorate them individually. The shim is already signature-driven, sov1_order()derives each target correctly with no special-casing — includingBaseDRIVLearner.bootstrap'sassignmentand theSensitivitymethods'p-second shape.prune/fill(tree-internal) and theSensitivityhelpers (evaluation-side), much less so for thebootstrapfamily, which is public API on the most-used learners.Note the
Sensitivitymethods are a third argument shape —(X, p, treatment, y)— so including them also answers open question 2 on the epic.Acceptance
test_every_treatment_y_method_is_shimmedintests/test_fit_arg_order.pyis widened pastSHIMMED_METHODSso it guards whichever set is chosen — today it only scans those four names, which is why this gap wasn't caught.