def test_actual_results_lower_bound_keogh():
    """Test that the actual results are the expected ones."""
    # Toy dataset
    X_train = np.asarray([[0, 1, 2, 3],
                          [1, 2, 3, 4]])
    X_test = np.asarray([[0, 2.5, 3.5, 6]])

    # Region = Sakoe-Chiba band (w=0)
    region = [[0, 1, 2, 3],
              [1, 2, 3, 4]]
    arr_actual = lower_bound_keogh(X_train, X_test, region)
    arr_desired = np.sqrt(np.sum(
        (X_test[:, None, :] - X_train[None, :, :]) ** 2, axis=-1
    ))
    np.testing.assert_allclose(arr_actual, arr_desired, atol=1e-5, rtol=0)

    # Region = Sakoe-Chiba band (w=1)
    region_window = [[0, 0, 1, 2],
                     [2, 3, 4, 4]]
    arr_actual_window = lower_bound_keogh(X_train, X_test, region_window)
    # lower = [[0, 0, 1, 2], [1, 1, 2, 3]]
    # upper = [[1, 2, 3, 3], [2, 3, 4, 4]]
    # X_proj = [[0, 2, 3, 3], [1, 2.5, 3.5, 4]]
    # LB_Keogh = [[sqrt(0.25 + 0.25 + 9), sqrt(1 + 4)]]
    arr_desired_window = np.sqrt([[9.5, 5]])
    np.testing.assert_allclose(arr_actual_window, arr_desired_window,
                               atol=1e-5, rtol=0)
Test that the actual results are the expected ones.
pyts/metrics/tests/test_lower_bounds.py