CausalDiscoveryToolbox icon indicating copy to clipboard operation
CausalDiscoveryToolbox copied to clipboard

How to generate single-direction graph with SAM?

Open Gaohan123 opened this issue 4 years ago • 1 comments

Hi~Thanks for your kind sharing. I run SAM algorithm with my own dataset. First I use the API to generate a graph: skeleton = sam.create_graph_from_data(data) Then I use another API to remove indirect edges: new_skeleton = cdt.utils.graph.remove_indirect_links(skeleton, alg='aracne') Later I do causal discovery with the API: output = sam.predict(data, new_skeleton)

However, I find that every edge of the graph is still bidirectional. Is there a way to generate single-direction graph? After all, causal relationship must have certain direction. Thank you!

Gaohan123 avatar Nov 25 '21 10:11 Gaohan123

Hello, There is no need for the input of SAM to be preprocessed with a algorithm such as ARACNE. The best is to give the full data to the model.

One execution of SAM provides a binary adjacency matrix representing the predicted causal graph. We noticed however that running SAM multiple times and averaging the results does provide better performance.

The output of the function is thus a matrix with confidence scores on each edge. From there on; it's up to the user to threshold between 0 and 1 according to the desired precision-recall. We noticed that one of the best values to threshold on is .7, as the resulting edges are a DAG and provides good performance.

Best regards, Diviyan

diviyank avatar Jan 12 '22 10:01 diviyank