@@ -0,0 +1,2289 @@
+import pytest%0A%0Afrom pyannote.core import Annotation%0Afrom pyannote.core import Segment%0Afrom pyannote.core import Timeline%0Afrom pyannote.metrics.identification import IdentificationErrorRate%0Afrom pyannote.metrics.identification import IdentificationPrecision%0Afrom pyannote.metrics.identification import IdentificationRecall%0A%0Aimport numpy.testing as npt%0A%0A%0A@pytest.fixture%0Adef reference():%0A    reference = Annotation()%0A    reference%5BSegment(0, 10)%5D = 'A'%0A    reference%5BSegment(12, 20)%5D = 'B'%0A    reference%5BSegment(24, 27)%5D = 'A'%0A    reference%5BSegment(30, 40)%5D = 'C'%0A    return reference%0A%0A%0A@pytest.fixture%0Adef hypothesis():%0A    hypothesis = Annotation()%0A    hypothesis%5BSegment(2, 13)%5D = 'A'%0A    hypothesis%5BSegment(13, 14)%5D = 'D'%0A    hypothesis%5BSegment(14, 20)%5D = 'B'%0A    hypothesis%5BSegment(22, 38)%5D = 'C'%0A    hypothesis%5BSegment(38, 40)%5D = 'D'%0A    return hypothesis%0A%0A%0Adef test_error_rate(reference, hypothesis):%0A    identificationErrorRate = IdentificationErrorRate()%0A    error_rate = identificationErrorRate(reference, hypothesis)%0A    npt.assert_almost_equal(error_rate, 0.5161290322580645, decimal=7)%0A%0A%0Adef test_detailed(reference, hypothesis):%0A    identificationErrorRate = IdentificationErrorRate()%0A    details = identificationErrorRate(reference, hypothesis, detailed=True)%0A%0A    confusion = details%5B'confusion'%5D%0A    npt.assert_almost_equal(confusion, 7.0, decimal=7)%0A%0A    correct = details%5B'correct'%5D%0A    npt.assert_almost_equal(correct, 22.0, decimal=7)%0A%0A    rate = details%5B'identification error rate'%5D%0A    npt.assert_almost_equal(rate, 0.5161290322580645, decimal=7)%0A%0A    false_alarm = details%5B'false alarm'%5D%0A    npt.assert_almost_equal(false_alarm, 7.0, decimal=7)%0A%0A    missed_detection = details%5B'missed detection'%5D%0A    npt.assert_almost_equal(missed_detection, 2.0, decimal=7)%0A%0A    total = details%5B'total'%5D%0A    npt.assert_almost_equal(total, 31.0, decimal=7)%0A%0A%0Adef test_precision(reference, hypothesis):%0A    identificationPrecisions = IdentificationPrecision()%0A    precision = identificationPrecisions(reference, hypothesis)%0A    npt.assert_almost_equal(precision, 0.611, decimal=3)%0A%0A%0Adef test_recall(reference, hypothesis):%0A    identificationRecall = IdentificationRecall()%0A    recall = identificationRecall(reference, hypothesis)%0A    npt.assert_almost_equal(recall, 0.710, decimal=3)%0A

add identification error rate tests