def test_average_precision_chr5():
    assert_ap(
        *getfilenames('chr5'),
        AP=(
            # iou [0.5, 0.6]
            (51 * 1) * 3 +
            # iou [0.65, 0.75]
            (51 * 0.5) * 3) / (101 * 10))
示例#2
0
def test_matching_chr2():
    assert_matching(
        *getfilenames('chr2'),
        iouthr=[0.001, 0.5, 0.75, 0.95],
        extp=[3, 2, 1, 0],
        exfp=[3, 4, 5, 6],
        exfn=[0, 1, 2, 3]
    )
示例#3
0
def test_matching_chr8():
    assert_matching(
        *getfilenames('chr8'),
        iouthr=[0.001, 0.75],
        extp=[1, 0],
        exfp=[3, 5],
        exfn=[2, 3]
    )
def test_average_precision_chr7():
    assert_ap(
        *getfilenames('chr7'),
        AP=(
            # iou [0.5, 0.65]
            (67 * 1) * 4 +
            # iou [0.7, 0.8]
            (34 * 1) * 3) / (101 * 10))
示例#5
0
def test_matching_chr6():
    assert_matching(
        *getfilenames('chr6'),
        iouthr=[0.001, 0.3, 0.99],
        extp=[2, 1, 1],
        exfp=[2, 3, 3],
        exfn=[0, 1, 1]
    )
示例#6
0
def test_matching_chr7():
    assert_matching(
        *getfilenames('chr7'),
        iouthr=[0.001, 0.75, 0.85],
        extp=[2, 1, 0],
        exfp=[0, 1, 2],
        exfn=[1, 2, 3]
    )
示例#7
0
def test_matching_chr5():
    assert_matching(
        *getfilenames('chr5'),
        iouthr=[0.001, 0.35, 0.6, 0.78],
        extp=[2, 1, 1, 0],
        exfp=[0, 0, 0, 2],
        exfn=[0, 1, 1, 2]
    )
示例#8
0
def test_matching_chr4():
    assert_matching(
        *getfilenames('chr4'),
        iouthr=[0.001, 0.5, 0.6, 0.75],
        extp=[1, 0, 0, 0],
        exfp=[0, 0, 1, 2],
        exfn=[0, 1, 1, 1]
    )
示例#9
0
def test_matching_chr3():
    assert_matching(
        *getfilenames('chr3'),
        iouthr=[0.001, 0.5, 0.75, 0.95],
        extp=[3, 3, 2, 0],
        exfp=[0, 0, 2, 4],
        exfn=[0, 0, 1, 3]
    )
def test_average_precision_chr2():
    assert_ap(
        *getfilenames('chr2'),
        AP=(
            # iou [0.5, 0.6]
            (67 * 1) * 3 +
            # iou [0.65, 0.8]
            (34 * 0.5) * 4) / (101 * 10))
示例#11
0
def test_matching_chr1():
    assert_matching(
        *getfilenames('chr1'),
        iouthr=[0.001, 0.5, 0.75, 0.95],
        extp=[2, 1, 1, 1],
        exfp=[0, 1, 1, 1],
        exfn=[1, 2, 2, 2]
    )
def test_AP():
    eps = 1e-6
    labels, peaks = [], []
    for i in range(1, 9):
        l, p = getfilenames(f'chr{i}')
        labels.append(l)
        peaks.append(p)

    expected = 0.16101468842536426
    assert abs(AP(peaks, labels) - expected) < eps
def test_average_precision_chr3():
    assert_ap(
        *getfilenames('chr3'),
        AP=(
            # iou [0.5, 0.65]
            (101 * 1) * 4 +
            # iou 0.7
            (34 * 1 + 67 * 0.75) +
            # iou [0.75, 0.8]
            (67 * 0.5) * 2) / (101 * 10))
示例#14
0
def chr1_gz():
    return (*_chr1(), getfilenames("chr1", gz=True))
def test_average_precision_chr8():
    assert_ap(
        *getfilenames('chr8'),
        AP=(
            # iou 0.5
            (34 * 1)) / (101 * 10))
示例#16
0
def chr2_gz():
    return (*_chr2(), getfilenames("chr2", gz=True))
def test_average_precision_chr6():
    assert_ap(
        *getfilenames('chr6'),
        AP=(
            # iou [0.5, 0.95]
            (51 * 1) * 10) / (101 * 10))
示例#18
0
def chr1():
    return (*_chr1(), getfilenames("chr1"))
def test_average_precision_chr4():
    assert_ap(*getfilenames('chr4'), AP=0)
示例#20
0
def chr2():
    return (*_chr2(), getfilenames("chr2"))
def test_average_precision_chr1():
    # 34 * 0.5 / 101 => for iou threshold = 0.5, 34 recall points map to the precision 0.5, the rest are 0.
    # Average precision is averaged for total recall points(101) and IOU thresholds
    # IOU thresholds are not used here, PRC is the same for every threshold).
    assert_ap(*getfilenames('chr1'), AP=34 * 0.5 / 101)