FenTechSolutions / CausalDiscoveryToolbox

Package for causal inference in graphs and in the pairwise settings. Tools for graph structure recovery and dependencies are included.
https://fentechsolutions.github.io/CausalDiscoveryToolbox/html/index.html
MIT License
1.09k stars 199 forks source link

Sign of the IGCI score #14

Closed wpzdm closed 5 years ago

wpzdm commented 5 years ago

Hi Diviyan,

I think the sign of the IGCI score is wrong.

In the UAI 2010 paper, on page 5, at the beginning of sec 3.5, Cx2y = S(Py) - S(Px) after preprocessing. And on page 3, after Postulate 2, the paper says negative value of Cx2y indicates X cause Y.

Thus, in method predict_proba of class IGCI, line 105, the entropy estimator should be eval_entropy(x) - eval_entropy(y) (replace x and y). Now, positve return value indicates X cause Y.

Running the code on CEP dataset, the result also agrees with the above.

Best, Abel

wpzdm commented 5 years ago

And it is similar for integral_approx_estimator.

diviyank commented 5 years ago

Hi Abel, This sign is a choice made by design of the package. All pairwise algorithms output a float value between -1 and 1. 1 indicates the causal direction (1st variable causes the 2nd) whereas -1 indicates anticausal direction. The float value is often used to specify the confidence of the algorithm in its prediction.

I do understand your confusion however. I should add a warning/note in the docs.

Thanks for the feedback ! Best, Diviyan

wpzdm commented 5 years ago

Hi Diviyan,

Thanks for the reply!

Maybe I did not make myself clear enough. I was aware of sign of return value of pairwise algorithms in this package from your documentation. Actually, I meant that the return value of IGCI method contradicts the above. That is, given the current implementation, positive return value means anticausal direction (2nd variable causes the 1st).

Best, Abel

diviyank commented 5 years ago

Whoops, you're right, I'll fix that asap

diviyank commented 5 years ago

It should be done, I'll be closing this issue. Don't hesitate to reopen it if the issue remains. Thanks again for the feedback !