Ejemplo n.º 1
0
def test_get_metrics_with_shift_predicted_zero():
    actual = [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0]
    predicted = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    metrics = get_metrics_with_shift(predicted, actual, 'cat', window_size=1)
    assert metrics['cat']['TP'] == 0
    assert metrics['cat']['FP'] == 0
    assert metrics['cat']['TN'] == 0
    assert metrics['cat']['FN'] == 2

    actual = [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1]
    metrics = get_metrics_with_shift(predicted, actual, 'cat', window_size=1)
    assert metrics['cat']['TP'] == 0
    assert metrics['cat']['FP'] == 0
    assert metrics['cat']['TN'] == 0
    assert metrics['cat']['FN'] == 4
Ejemplo n.º 2
0
def test_get_metrics_with_shift_in_large_window():
    actual =    [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
    predicted = [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
    metrics = get_metrics_with_shift(predicted, actual, 'cat', window_size=4)
    assert metrics['cat']['TP'] == 1
    assert metrics['cat']['FP'] == 0
    assert metrics['cat']['TN'] == 0
    assert metrics['cat']['FN'] == 0