graphical_models.classes.dags.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
>>> from graphical_models import DAG >>> import numpy as np >>> amat = np.array([[0, 0, 1], [0, 0, 1], [0, 0, 0]]) >>> d = DAG.from_amat(amat) >>> d.arcs {(0, 2), (1, 2)}