Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uplift p_value is NAN #585

Open
yanduoduan opened this issue Dec 1, 2022 · 4 comments
Open

uplift p_value is NAN #585

yanduoduan opened this issue Dec 1, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@yanduoduan
Copy link

This uplift p_value is nan occurs when using UpliftTreeClassifier,why?

@yanduoduan yanduoduan added the bug Something isn't working label Dec 1, 2022
@paullo0106
Copy link
Collaborator

@yanduoduan do you mind sharing more information? maybe a code snippet you were using, thanks

@yanduoduan
Copy link
Author

from IPython.display import Image
from causalml.inference.tree import UpliftTreeClassifier, UpliftRandomForestClassifier
from causalml.inference.tree import uplift_tree_string, uplift_tree_plot
from causalml.dataset import make_uplift_classification
x = [[170,3,18,'v1',0],
[1210,4,11,'v1',123.4],
[150,7,-99,'v2',300],
[230,11,6,'v2',0],
[20,1,-99,'v1',523.7]]
df = pd.DataFrame(x,columns=['x1','x2','x3','version','outcome'])
uplift_model = UpliftTreeClassifier(max_depth=3, min_samples_leaf=1, min_samples_treatment=1,
n_reg=100, evaluationFunction='ED', control_name='v1')
x_names = ['x1','x2','x3']
uplift_model.fit(df[x_names].values,
treatment=df['version'].values,
y=df['outcome'].values)

graph = uplift_tree_plot(uplift_model.fitted_uplift_tree, x_names)
Image(graph.create_png())

Thanks,My y is a continuous variable, and I want to distinguish people through the tree model to guide my decision-making.

@paullo0106
Copy link
Collaborator

hmm UpliftTreeClassifier is for binary variable, for regression problem with continuous variable, you might want to check out from causalml.inference.tree import CausalTreeRegressor, we have a notebook for that https://github.com/uber/causalml/blob/master/examples/causal_trees_with_synthetic_data.ipynb

@yanduoduan
Copy link
Author

ok. Thanks. How do I use CausalTreeRegressor if I have one control and multiple tratement? How to interpret the generated tree?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants