%pylab inline
Populating the interactive namespace from numpy and matplotlib
from pyannote.core import Annotation, Segment
reference = Annotation()
reference[Segment(0, 10)] = 'A'
reference[Segment(12, 20)] = 'B'
reference[Segment(24, 27)] = 'A'
reference[Segment(30, 40)] = 'C'
reference
hypothesis = Annotation()
hypothesis[Segment(2, 13)] = 'A'
hypothesis[Segment(13, 14)] = 'D'
hypothesis[Segment(14, 20)] = 'B'
hypothesis[Segment(22, 38)] = 'C'
hypothesis[Segment(38, 40)] = 'D'
hypothesis
from pyannote.metrics.identification import IdentificationErrorRate
identificationErrorRate = IdentificationErrorRate()
print("IER = {0:.3f}".format(identificationErrorRate(reference, hypothesis, uem=Segment(0, 40))))
IER = 0.516
imshow(reference * hypothesis, interpolation='nearest'); colorbar();
from pyannote.metrics.identification import IdentificationPrecision
precision = IdentificationPrecision()
print("Precision = {0:.3f}".format(precision(reference, hypothesis, uem=Segment(0, 40))))
Precision = 0.611
from pyannote.metrics.identification import IdentificationRecall
recall = IdentificationRecall()
print("Recall = {0:.3f}".format(recall(reference, hypothesis, uem=Segment(0, 40))))
Recall = 0.710