medil.evaluate.sfd
- medil.evaluate.sfd(true_biadj: numpy.typing.NDArray, predicted_biadj: numpy.typing.NDArray, to_return: str = 'raw') int | float | tuple[int, float][source]
Structural Frobenius distance sums difference of latent parents.
For a binary biadjacency matrix B, consider U = B’B, where U_ij counts the number of parents nodes i and j have in common (so U_ii is the assignment number, and diag(U) is a sufficient statistic for the graph under the 1-pure-child assumption). sfd(B_1, B_2) is the sum of the differences between U_ij for B_1 and B_2 (without double-counting for U_ji).
- Parameters:
true_biadj (ndarray) – Ground-truth biadjacency matrix.
predicted_biadj (ndarray) – Learned biadjacency matrix.
to_return (str, optional) –
"raw"(default),"normalized", or"both".
- Returns:
Raw sfd (int) if
to_return='raw', normalized nsfd (float) ifto_return='normalized', or(sfd, nsfd)ifto_return='both'.- Return type:
int or float or tuple