Serialization + BaseEstimator conformance for kernel uplift classes (#954)#971
Open
jeongyoonlee wants to merge 1 commit into
Open
Serialization + BaseEstimator conformance for kernel uplift classes (#954)#971jeongyoonlee wants to merge 1 commit into
jeongyoonlee wants to merge 1 commit into
Conversation
#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
marked this pull request as ready for review
July 25, 2026 05:33
jeongyoonlee
requested review from
alexander-pv,
huigangchen,
paullo0106,
ppstacy,
ras44,
t-tte,
vincewu51 and
zhenyuz0500
July 25, 2026 05:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Part of the tree-unification epic (#945). Gives the experimental kernel-backed uplift classes first-class serialization and scikit-learn
BaseEstimatorconformance._KernelUpliftTreeClassifierand_KernelUpliftRandomForestClassifiernow inheritSerializableLearner(nativesave/load), matching the causal classes (CausalTreeRegressor/CausalRandomForestRegressor)._KernelUpliftTreeClassifier.__init__intofit, so the constructor stores its arguments verbatim (sklearnget_params/cloneround-trip). The forcing still takes effect at fit time.Scope decisions (confirmed with maintainer)
tree/__init__.pysave/load/_is_fittedmonkey-patch serves the legacy publicUpliftTreeClassifier/UpliftRandomForestClassifier. Deleting it now would regress legacy serialization before the [Tree unification 9/9] Switchover + delete legacy uplift.pyx + deprecations #955 switchover, so it stays until [Tree unification 9/9] Switchover + delete legacy uplift.pyx + deprecations #955 (when the public classes become kernel-backed and inherit serialization natively). This matches epic Open Question add a disclaimer to README.md #1.check_estimator. Stockcheck_estimatorcannot run against afit(X, treatment, y)signature (sklearn callsfit(X, y)), and the repo has nocheck_estimatorprecedent. This PR covers the achievable conformance —save/loadround-trip,get_params/cloneround-trip, and__init__-stores-args-verbatim — and documents why fullcheck_estimatoris N/A in the class docstrings.Tests (tests/test_uplift_trees_kernel.py)
save/loadround-trip for tree and forest (predictions match).saveraises.get_params/cloneround-trip for both.__init__stores args verbatim (incl. IDDPhonesty=False).test_kernel_uplift_iddp_forces_honestyto assert the new fit-time contract (honesty forced at fit;honestystored verbatim).Full
tests/test_uplift_trees_kernel.pygreen;blackclean.