andrey.metrics.temporal_scores#
- andrey.metrics.temporal_scores(estimated, true)[source]#
Per-lag and summary scores for a temporal structure.
Returns
per_lag(each lag’s precision/recall/f1/shd), acontemporaneousblock when the estimate carries lag-0, an aggregatelaggedblock over lags >= 1, asummarygraph collapsing every scored lag (self-loops excluded so diagonals do not inflate it), andcoefficient_mae_per_lagwhen both structures carry lag weights.Raises
NotImplementedErrorfor a time-carrying structure (n_times > 0): the(time, lag)axis has no metric yet, and scoring only the final-occasion projection would silently miss per-occasion differences.Examples
>>> import numpy as np >>> from andrey.core import GraphStructure, TemporalStructure >>> g = GraphStructure.from_numpy(np.array([[0, 1], [2, 0]], dtype=np.int8), kind="dag") >>> t = TemporalStructure.from_lag_graphs([g]) >>> temporal_scores(t, t)["summary"]["f1"] 1.0