andrey.metrics.direction_accuracy#
- andrey.metrics.direction_accuracy(pred, truth, *, weights=None)[source]#
Fraction of decided pairs whose predicted cause -> effect direction matches the truth.
predandtruthare per-pair signed labels (+1=X -> Y,-1=Y -> X); apredof 0 is an abstention, dropped before scoring.weightsgives optional per-pair weights (the Tuebingen-pairs standard). Returns 0.0 when nothing is decided; pair it withdecision_rate()so a high accuracy from few decisions is visible.- Return type:
Examples
>>> direction_accuracy([1, 1, -1], [1, -1, -1]) 0.6666666666666666