Comments (2)
Uhmm I hard coded it out by start with a fully connected graph, and then removing all edges, and then adding edges. Not the most elegant way, but seems to work.
def array2dag(array):
num_nodes = array.shape[0]
cg = CausalGraph(num_nodes)
for i in range(num_nodes):
for j in range(num_nodes):
edge1 = cg.G.get_edge(cg.G.nodes[i], cg.G.nodes[j])
if edge1 is not None:
cg.G.remove_edge(edge1)
for i in range(num_nodes):
for j in range(num_nodes):
if adjacency_matrix[i,j] == 1:
cg.G.add_edge(Edge(cg.G.nodes[i], cg.G.nodes[j], Endpoint.TAIL, Endpoint.ARROW))
DAG = cg.G
return DAG
from causal-learn.
Yeah, that seems to do the job. We don't have an existing function to do this since the definition of the endpoints might vary in different cases, but it doesn't seem to be a very complicated procedure to transfer.
from causal-learn.
Related Issues (20)
- does this codebase support some recent causal discovery methods like, notears, dag-gnn,and so on HOT 2
- A potential Bug in GES.py HOT 1
- Null Hypothesis in Conditoinal Independence Tests HOT 2
- Boostrap Utilities HOT 1
- Background knowledge not used correctly? HOT 1
- Implementation for CCI? HOT 1
- How to estimate the causal effect? HOT 1
- Different results with Tetrad and causal-learn implementations. HOT 6
- numpy version HOT 1
- Understanding the FCI outputs (graph vs. printed edges) HOT 3
- Handling Data with Interventions HOT 4
- array must not contain infs or NaNs HOT 2
- use of deprecated `np.mat` HOT 3
- IndexError: tuple index out of range - From LocalScoreFunction.py HOT 1
- Key error FCI HOT 1
- Causal Discovery Algorithms For Time Series Data HOT 2
- Implementation of DAGMA
- Numpy overflow with discrete data HOT 3
- Potential Issue with get_sepset Function Failing to Identify Valid Separating Sets for Conditional Independence HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from causal-learn.