causaldag.classes.dag.DAG.from_amat¶
-
classmethod
DAG.
from_amat
(amat: numpy.ndarray)[source]¶ Return a DAG with arcs given by
amat
, i.e. i->j ifamat[i,j] != 0
.Parameters: amat – Numpy matrix representing arcs in the DAG. Examples
>>> import causaldag as cd >>> import numpy as np >>> amat = np.array([[0, 0, 1], [0, 0, 1], [0, 0, 0]]) >>> d = cd.DAG.from_amat(amat) >>> d.arcs {(0, 2), (1, 2)}