You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a heart disease dataset which has continuous variable as a treatment (thalach) and outcome categorical(target).There is another variable that the treatment affects (exang) which is categorical too. They have an inverse relation i.e. when thalach is increased, exang should come down. However, it is giving invalid values (-1) of exang (0,1) when intervened on thalach, using counterfactual_samples.
Hi, I am wondering, it seems the categorical variables are numerical here. Can you try converting them to strings or bools (if binary)? Otherwise, the models will interpret these as discrete (with order) or continuous.
When you convert them to categorical values (strings/bools), an issue is, however, in that we only support point-wise counterfactual estimates (in Pearl's sense). You might need to look at interventional samples instead (which also work with categorical non-root nodes). This would be:
I am working on a heart disease dataset which has continuous variable as a treatment (thalach) and outcome categorical(target).There is another variable that the treatment affects (exang) which is categorical too. They have an inverse relation i.e. when thalach is increased, exang should come down. However, it is giving invalid values (-1) of exang (0,1) when intervened on thalach, using counterfactual_samples.
samples = gcm.counterfactual_samples(causal_model, {'thalach': lambda thalach:thalach * 1.1}, observed_data=df_risk).
Before and after intervention:
Although, I have a hack by clipping values. I would like to know if there is something built in to constrain the effect of intervention.
The text was updated successfully, but these errors were encountered: