Skip to content

Serialization + BaseEstimator conformance for kernel uplift classes (#954)#971

Open
jeongyoonlee wants to merge 1 commit into
masterfrom
feature/954-serialization
Open

Serialization + BaseEstimator conformance for kernel uplift classes (#954)#971
jeongyoonlee wants to merge 1 commit into
masterfrom
feature/954-serialization

Conversation

@jeongyoonlee

Copy link
Copy Markdown
Collaborator

What

Part of the tree-unification epic (#945). Gives the experimental kernel-backed uplift classes first-class serialization and scikit-learn BaseEstimator conformance.

  • _KernelUpliftTreeClassifier and _KernelUpliftRandomForestClassifier now inherit SerializableLearner (native save / load), matching the causal classes (CausalTreeRegressor / CausalRandomForestRegressor).
  • Moved the IDDP-forces-honesty logic out of _KernelUpliftTreeClassifier.__init__ into fit, so the constructor stores its arguments verbatim (sklearn get_params / clone round-trip). The forcing still takes effect at fit time.

Scope decisions (confirmed with maintainer)

Tests (tests/test_uplift_trees_kernel.py)

  • save/load round-trip for tree and forest (predictions match).
  • Unfitted save raises.
  • get_params/clone round-trip for both.
  • Load class-mismatch raises.
  • __init__ stores args verbatim (incl. IDDP honesty=False).
  • Updated test_kernel_uplift_iddp_forces_honesty to assert the new fit-time contract (honesty forced at fit; honesty stored verbatim).

Full tests/test_uplift_trees_kernel.py green; black clean.

#954)

Give the experimental kernel-backed uplift classes first-class serialization
and scikit-learn BaseEstimator conformance (part of #945):

- _KernelUpliftTreeClassifier / _KernelUpliftRandomForestClassifier inherit
  SerializableLearner (native save/load), like the causal classes.
- Move the IDDP-forces-honesty logic from __init__ into fit so the constructor
  stores its arguments verbatim (sklearn get_params/clone round-trip); the
  forcing still takes effect at fit time.

Curated conformance: stock check_estimator cannot run against a
fit(X, treatment, y) signature, so this covers save/load, get_params/clone, and
__init__-verbatim, and documents check_estimator as N/A in the docstrings. The
legacy tree/__init__.py monkey-patch is retained (it serves the legacy public
classes) and is removed at the #955 switchover.

Tests: save/load round-trip, unfitted-save-raises, get_params/clone round-trip,
load class-mismatch, __init__-verbatim (incl. IDDP); updated
test_kernel_uplift_iddp_forces_honesty to the fit-time contract. 127 passed.
@jeongyoonlee
jeongyoonlee marked this pull request as ready for review July 25, 2026 05:33
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.

1 participant