Skip to content

Flip every signature to (X, y, treatment, ...) and delete the deprecation shim #985

Description

@jeongyoonlee

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

The breaking change itself: reorder every signature to (X, y, treatment, …) and delete the deprecation shim.

This lands as one change. Once a signature is reordered, existing positional calls break silentlyy and treatment are both same-length arrays, so there is no TypeError to catch a swap. A partially flipped package is therefore worse than either end state, and no subset of this checklist may be released on its own.

Blocked by the window-closing issues on #980: the shim's coverage must be final (#981) and CausalML's own callers migrated (#982, #983) before anything moves.

The rule

X, then y, then treatment; every other parameter keeps its relative position. Already implemented as v1_order() in causalml/inference/_arg_order.py and derived per method from that method's own signature — so the target for each method is machine-readable, not hand-maintained. tests/test_fit_arg_order.py::test_v1_order pins it.

Checklist

  • Meta-learnersBaseSLearner, BaseTLearner, BaseXLearner, BaseRLearner, BaseDRLearner and subclasses (XGBTRegressor, XGBRRegressor, XGBRClassifier, XGBTClassifier, BaseXClassifier, BaseRClassifier, LRSRegressor), plus bootstrap / fit_bootstrap_ensemble
  • Causal trees and forestsCausalTreeRegressor (fit, fit_predict, estimate_ate, bootstrap, bootstrap_pool), CausalRandomForestRegressor
  • Uplift trees and forestsUpliftTreeClassifier / _KernelUpliftTreeClassifier, UpliftRandomForestClassifier / _KernelUpliftRandomForestClassifier; resolve the X_val, treatment_val, y_val question from the epic
  • IVIVRegressor.fit(X, y, treatment, w); BaseDRIVLearner.fit / fit_predict / estimate_ate / predict / bootstrap(X, y, treatment, assignment, …)
  • Neural estimators — TF and JAX DragonNet, Torch and JAX CEVAE
  • StandalonePolicyLearner, TMLELearner
  • Update every Args: docstring block to match the new order
  • Delete causalml/inference/_arg_order.py, the __init_subclass__ hook in causalml/inference/serialization.py, and the six @shim_arg_order class decorators
  • Rewrite tests/test_fit_arg_order.py to assert the new order rather than the deprecation (the file's docstring says to update, not delete, these tests)

Acceptance

  • inspect.signature(learner.fit).parameters starts X, y, treatment for every learner in the checklist.
  • No FutureWarning machinery remains; grep for _arg_order, shim_arg_order, _in_arg_order_call is empty.
  • Full suite green, and the equivalence test that guards against a silent y/treatment swap is retained in flipped form.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions