cdt15 / lingam

Python package for causal discovery based on LiNGAM.
https://sites.google.com/view/sshimizu06/lingam
MIT License
356 stars 54 forks source link

What is the advantage of the "global_only=True" parameter in the LiM method? #108

Open EsqYu opened 10 months ago

EsqYu commented 10 months ago

Hi. In the recent updates, the "global_only" parameter has been added to the model.fit() method of LiM. What is the advantage of setting this parameter to "True"?

sshimizu2006 commented 10 months ago

"global_only" is computationally faster, but could be somewhat less accurate.

EsqYu commented 10 months ago

Thanks for your reply. I understand that very well. Speaking about LiM, can this algorithm be used to infer causal relationships of mixed variables that consist of continuous and discrete but not limited to binary data like results of 5 star rating?

sshimizu2006 commented 10 months ago

LiM assumes binary variables. If your variables are 5 stars, you could assume such 5 stars are approximated well by continuous variables. Then, you could analyze your variables by methods for continuous variables.

EsqYu commented 10 months ago

Thank you. I understand that LiM can be used only for mixed data of continuous variables and binary variables. What kind of approximation method are generally used to deal with discrete variables other than binary ones?

I have another question. In the LiM tutorial(https://lingam.readthedocs.io/en/latest/tutorial/lim.html), there are Python codes which illustrate how to implement LiM. However, it seems that the sample model is not able to estimate the true adjacency matrix because the estimated one and the true one are different. Basically, I think tutorials include an example of a correct estimation, but this tutorial only shows a result of an incorrect estimation, so I wonder if this algorithm is not very accurate.

sshimizu2006 commented 10 months ago

I meant just assuming your 5 stars variables, that would take 1, 2, 3, 4, 5, are continuous.

EsqYu commented 10 months ago

I see. Then, what if the values of the variables are not related to the size of variables like a department code(0: Personnel 1: Sales Department ..., .etc)?

sshimizu2006 commented 10 months ago

If they are no ordinal, but categorical, no methods are available now in the package.

YanaZeng commented 10 months ago

Thank you. I understand that LiM can be used only for mixed data of continuous variables and binary variables. What kind of approximation method are generally used to deal with discrete variables other than binary ones?

I have another question. In the LiM tutorial(https://lingam.readthedocs.io/en/latest/tutorial/lim.html), there are Python codes which illustrate how to implement LiM. However, it seems that the sample model is not able to estimate the true adjacency matrix because the estimated one and the true one are different. Basically, I think tutorials include an example of a correct estimation, but this tutorial only shows a result of an incorrect estimation, so I wonder if this algorithm is not very accurate.

Can you show your experimental results? like how many variables and samples did you use and what kind of data types?

If you would like a better estimation, please choose "global_only=False". Or see our paper for more results (Y. Zeng, S. Shimizu, H. Matsui, F. Sun. Causal discovery for linear mixed data. In Proc. First Conference on Causal Learning and Reasoning (CLeaR2022). PMLR 177, pp. 994-1009, 2022.).

If there are 2 variables (one continuous and one binary) as shown in the tutorial, the estimation accuracy should be high, approx. 1 in F1 value.

EsqYu commented 10 months ago

Actually, I'm talking about the test results in the tutorial. As you see in the tutorial, the true adjacency matrix is [[0. 0. ] [1.3082251 0. ]], while the estimated matrix is [[ 0. , 0. ], [-1.09938457, 0. ]]. I believe the former one and the latter one are different, so I'm wondering if this algorithm estimates the true adjacency matrix correctly.

YanaZeng commented 10 months ago

Here we evaluate the performance of the causal structure between variables, not including its causal effects. So I am sorry to say that our algorithm cannot guarantee to estimate the causal effects accurately.

EsqYu commented 10 months ago

I understand. Then, is it correct that I can't use LiM just like I use LiNGAM, which can estimate both causal structures and causal effects?