Polish Polars support and add bootstrap CI test coverage#921
Conversation
jeongyoonlee
left a comment
There was a problem hiding this comment.
Thanks @aman-coder03 — this cleanly closes out all four #920 follow-ups. Verified locally with polars installed: tests/test_polars_support.py 38 passed (incl. the new test_bootstrap_ci_dataframe over pandas+polars and TestDRClassifierPolars), and the S/X-learner + bootstrap/return_ci regression in tests/test_meta_learners.py still passes, so the hoist and the y_filt_np[w == 1] switch are safe.
Approving. One trivial, non-blocking nit for whenever you're next in the file: in slearner.py the "Build separate frames … CatBoost sets the writeable flag to False …" comment now sits inside the loop while the X_new_c/X_new_t construction it describes moved above it — worth moving the comment up with the construction so it documents the right lines. Not worth holding the merge.
Proposed changes
this PR addresses the follow-ups from the native Polars support work in #901
it includes a small performance cleanup in the S-learner, simplifies the X-learner implementation by reusing existing NumPy arrays, replaces the hardcoded test seed with the shared constant, and adds regression tests covering the
store_bootstraps=True->predict(return_ci=True)path for DataFrame inputs, along with additional Polars test coverage for the DR classifiercloses #920
Types of changes
What types of changes does your code introduce to CausalML?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc. This PR template is adopted from appium.