uber / causalml

Uplift modeling and causal inference with machine learning algorithms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build fails in test_causal_trees.py, no attribute _support_missing_values

ras44 opened this issue · comments

Describe the bug
Builds are failing with a new error:

FAILED tests/test_causal_trees.py::TestCausalRandomForestRegressor::test_fit[5] - AttributeError: 'CausalTreeRegressor' object has no attribute '_support_missing_values'

See build at: https://github.com/uber/causalml/actions/runs/7626474561/job/20772942656?pr=722

To Reproduce

Follow build at: https://github.com/uber/causalml/actions/runs/7626474561/job/20772942656?pr=722

Expected behavior
No failure during build

Screenshots
image

Environment (please complete the following information):
See build at: https://github.com/uber/causalml/actions/runs/7626474561/job/20772942656?pr=722

Additional context
N/A

This is due to the recent change in scikit-learn introduced by scikit-learn/scikit-learn#26391, which added _support_missing_values() to _tree._classes.py that is called by ensemble._validate_X_predict().

We can either add _support_missing_values() to our _tree._class.py or add our own _validate_X_predict() for CausalTreeRegressor/CausalRandomForestRegressor.

@alexander-pv, what do you think? I will leave it to you.

Hi, @ras44, @jeongyoonlee, thanks for asking!

I suggest adding _support_missing_values() to _tree._class.py with a temporary placeholder since the issue is directly related to scikit-learn/scikit-learn#23595 where they updated cython backend for that.
I've opened PR #734.

Since I am working on a multiple treatment groups feature in causal trees which is also mainly related to cython, I think I will be able to add missing values support after finishing my WIP idea.