Describe the bug
CausalRandomForestRegressor.calculate_error() delegates to forestci (forestci==0.6, pinned in pyproject.toml). forestci.calc_inbag() calls scikit-learn's private _get_n_samples_bootstrap and _generate_sample_indices with their pre-1.9 signatures and has no version guard, so on scikit-learn 1.9 it raises:
TypeError: _get_n_samples_bootstrap() missing 1 required positional argument: 'sample_weight'
.../forestci/forestci.py (in calc_inbag)
The latest forestci (0.7 / master) is still unfixed.
Why it can't be worked around from causalml alone
random_forest_error(..., calibrate=True) (the default) makes a recursive call on a subsampled forest that recomputes inbag internally without forwarding a caller-supplied inbag, so passing a precomputed inbag to calculate_error() only sidesteps the break for calibrate=False.
Scope / status
fit() and predict() on scikit-learn 1.9 are fixed in #905. calculate_error() remains unsupported on >= 1.9 until forestci is updated upstream and the pin bumped. The test_unbiased_sampling_error cases are marked xfail (non-strict, so they XPASS automatically once forestci is fixed).
Options when resolving
- Upstream fix in forestci (version-guard the two private calls) + bump the causalml pin. (Preferred; upstream issue to be filed.)
- A scikit-learn >= 1.9 compatibility shim in
calculate_error() that defaults sample_weight=None on forestci's private calls (validated working locally).
- Vendor forestci's inbag / variance computation into causalml (more maintenance / vendoring fragility).
Describe the bug
CausalRandomForestRegressor.calculate_error()delegates toforestci(forestci==0.6, pinned inpyproject.toml).forestci.calc_inbag()calls scikit-learn's private_get_n_samples_bootstrapand_generate_sample_indiceswith their pre-1.9 signatures and has no version guard, so on scikit-learn 1.9 it raises:The latest forestci (0.7 /
master) is still unfixed.Why it can't be worked around from causalml alone
random_forest_error(..., calibrate=True)(the default) makes a recursive call on a subsampled forest that recomputesinbaginternally without forwarding a caller-suppliedinbag, so passing a precomputedinbagtocalculate_error()only sidesteps the break forcalibrate=False.Scope / status
fit()andpredict()on scikit-learn 1.9 are fixed in #905.calculate_error()remains unsupported on >= 1.9 until forestci is updated upstream and the pin bumped. Thetest_unbiased_sampling_errorcases are markedxfail(non-strict, so they XPASS automatically once forestci is fixed).Options when resolving
calculate_error()that defaultssample_weight=Noneon forestci's private calls (validated working locally).