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

BaseXClassifier and BaseRClassifier failes #180

Closed
Jami1141 opened this issue May 28, 2020 · 3 comments
Closed

BaseXClassifier and BaseRClassifier failes #180

Jami1141 opened this issue May 28, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Jami1141
Copy link

I have a dataframe including some features, a multiple treatment (0,1,2) and a binary outcome (0,1).
When I try:
learner = BaseSClassifier(XGBClassifier(), control_name='control')
learner.fit(X=X, treatment=treatment, y=y)
cate = learner.predict(X=X, treatment=treatment, y=y)

And,

learner = BaseTClassifier(XGBClassifier(), control_name='control')
learner.fit(X=X, treatment=treatment, y=y)
cate = learner.predict(X=X, treatment=treatment, y=y)

For both I have cate values but for :

learner = BaseXClassifier(XGBClassifier(), control_name='control')
learner.fit(X=X, treatment=treatment, y=y)
cate = learner.predict(X=X, treatment=treatment, y=y)

And,
learner = BaseRClassifier(XGBClassifier(), control_name='control')
learner.fit(X=X, treatment=treatment, y=y)
cate = learner.predict(X=X, treatment=treatment, y=y)

I have following error: ValueError: Either the outcome learner or the effect learner pair must be specified.

@yungmsh
Copy link
Contributor

yungmsh commented Jun 26, 2020

Hi @Jami1141, thanks for bringing this up. These are the current arguments for the BaseXClassifier:

        Args:
            learner (optional): a model to estimate outcomes or treatment effects in both the control and treatment
                groups. Even if specified, the user must still input either the outcome learner or the effect learner
                pair.
            control_outcome_learner (optional): a model to estimate outcomes in the control group.
                Should have a predict_proba() method.
            treatment_outcome_learner (optional): a model to estimate outcomes in the treatment group.
                Should have a predict_proba() method.
            control_effect_learner (optional): a model to estimate treatment effects in the control group
            treatment_effect_learner (optional): a model to estimate treatment effects in the treatment group
            ate_alpha (float, optional): the confidence level alpha of the ATE estimate
            control_name (str or int, optional): name of control group

I realize this is a little confusing (due to all the optional flags), but there's a little note that says "Even if specified, the user must still input either the outcome learner or the effect learner pair." At the moment the best way to use the BaseXClassifier is to ignore learner, provide classifier models for control_outcome_learner and treatment_outcome_learner, and provide regressor models for control_effect_learner and treatment_effect_learner. The reason here is that the "outcome" is a class (so we need a classifier), but the effect is continuous (so we need a regressor). Similar logic applies to BaseRClassifier.

(cc @jeongyoonlee) Moving forward though, I think we should modify the args to provide outcome_learner and treatment_learner instead of learner to get around this problem.

@jeongyoonlee
Copy link
Collaborator

@yungmsh agreed. For all classifiers, let's remove learner from input arguments. Could you please work on it?

@yungmsh yungmsh added the bug Something isn't working label Jun 26, 2020
@yungmsh
Copy link
Contributor

yungmsh commented Jun 26, 2020

Yep will add it to my list on the next push.

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

4 participants