otlingam.utils.f1_score¶
- f1_score(adjacency_matrix_true, adjacency_matrix_pred)[source]¶
Computes the directed-edge F1 score between two adjacency matrices.
The adjacency matrices are binarized by treating nonzero entries as edges. Diagonal entries are ignored, and directed edges are compared according to the LiNGAM convention, where entry (j, k) represents the edge \(k \to j\).
- Parameters:
adjacency_matrix_true (np.typing.ArrayLike) – Ground-truth weighted adjacency matrix.
adjacency_matrix_pred (np.typing.ArrayLike) – Estimated weighted adjacency matrix.
- Returns:
Directed-edge F1 score.
- Return type:
float
- Raises:
ValueError – If either matrix is not square or the shapes differ.