Ejemplo n.º 1
0
def test_calculate_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 = calculate_metrics_with_shift(predicted, actual, window_size=1)
    assert metrics['TP'] == 0
    assert metrics['FP'] == 0
    assert metrics['FN'] == 2

    actual = [1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1]
    metrics = calculate_metrics_with_shift(predicted, actual, window_size=1)
    assert metrics['TP'] == 0
    assert metrics['FP'] == 0
    assert metrics['FN'] == 4
Ejemplo n.º 2
0
def test_calculate_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 = calculate_metrics_with_shift(predicted, actual, window_size=4)
    assert metrics['TP'] == 1
    assert metrics['FP'] == 0
    assert metrics['FN'] == 0
Ejemplo n.º 3
0
def test_calculate_metrics_with_shift_mixed():
    actual = [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0]
    predicted = [0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0]
    metrics = calculate_metrics_with_shift(predicted, actual, window_size=1)
    assert metrics['TP'] == 1
    assert metrics['FP'] == 1
    assert metrics['FN'] == 1