andrey.metrics.number_of_latents#
- andrey.metrics.number_of_latents(graph)[source]#
Count of nodes flagged
LATENT(0 whennode_typesis unset).- Return type:
Examples
>>> import numpy as np >>> from andrey.core import GraphStructure, LATENT, OBSERVED >>> m = np.array([[0, 0, 2], [0, 0, 2], [1, 1, 0]], dtype=np.int8) >>> types = np.array([OBSERVED, OBSERVED, LATENT], dtype=np.int8) >>> number_of_latents(GraphStructure.from_numpy(m, kind="dag", node_types=types)) 1