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.08k stars 198 forks source link

How can I generate a graph from a data without using cdt.data.AcyclicGraphGenerator #132

Open MAX00008888 opened 2 years ago

MAX00008888 commented 2 years ago

@Diviyan-Kalainathan , sorry to bother you. I don't understand the difference between create_graph_from_data(data, **kwargs) and orient_directed_graph(data, dag, **kwargs)``predict(df_data, graph=None, **kwargs). How can I generate a graph like this waydata, graph = generator.generate().

MAX00008888 commented 2 years ago

how to get a graph contains the ground truth of the dataset @Diviyan-Kalainathan

diviyank commented 2 years ago

Hello @MAX00008888,

There are two distinct things :

Actually, predict regroups multiple functions for causal discovery methods, one that cover each case, and runs for each a different function:

Hope this helps, Diviyan

MAX00008888 commented 2 years ago

Thank you soooo much for your relpy @Diviyan-Kalainathan ,

I'm still a little confused. Here is my code: data= pd.DataFrame(batch.next_observations.cpu().numpy(), columns=cols) model = GES() graph = model.create_graph_from_data(data) Is this get the same kind of graph like data, graph = generator.generate().

Thank again!

diviyank commented 2 years ago

Yes, GES aims at producting the same graph as the one that generated your data (here batch.next_observations.cpu().numpy()) ; it tries to find causal relationships between the columns of your data.

Best, Diviyan

P.S. : be warned however, GES aims to produce the ground truth of your data and therefore the results are not always 100% correct; compared to the AcyclicGraphGenerator (that actually generates data according to the graph), the causal methods do not provide the true answer (it's their goal, but it's the whole point of the research)

MAX00008888 commented 2 years ago

Thank you so much ! !!@Diviyan-Kalainathan It may sound silly , but I would like to know if there is anyway to get the true graph of data.

Thanks

MAX00008888 commented 2 years ago

Hi Diviyan, @Diviyan-Kalainathan

I want to know if there is a score function like BIC score to get the score of the graph.

Best,

diviyank commented 2 years ago

Hi,

Sadly, the causal methods try to find the true graph of the data (or the markov equivalence class - check out CPDAG), and more often than not, the assumptions made by the used models are violated. Thus the approximate result has not optimal guarantees on the validity of the proposed solution.

We don''t have a score function such as BIC in the toolbox, but that's a good idea ! I will look into it.

Best regards, Diviyan

MAX00008888 commented 2 years ago

Thank you so much for your reply!!! So sorry that I forgot to reply you, you can close this question.

Best wishes.

diviyank commented 2 years ago

Hello! You're welcome! I'll just keep this issue open to add the scores in the development roadmap