def test_lower_bounds_inequalities():
    """Test that the expected inequalities are verified."""
    # Toy dataset
    rng = np.random.RandomState(42)
    n_samples_train, n_samples_test, n_timestamps = 20, 30, 60
    window_size = 0.1
    X_train = rng.randn(n_samples_train, n_timestamps)
    X_test = rng.randn(n_samples_test, n_timestamps)

    # DTW
    X_dtw = pairwise_distances(X_test, X_train, dtw)
    region = sakoe_chiba_band(n_timestamps, window_size=window_size)
    X_dtw_window = pairwise_distances(X_test, X_train, _dtw_sakoechiba,
                                      window_size=window_size)

    # Lower bounds
    lb_yi = lower_bound_yi(X_train, X_test)
    lb_kim = lower_bound_kim(X_train, X_test)
    lb_keogh = lower_bound_keogh(X_train, X_test, region)
    lb_improved = lower_bound_improved(X_train, X_test, region)

    # Sanity check
    EPS = 1e-8
    np.testing.assert_array_less(lb_yi, X_dtw + EPS)
    np.testing.assert_array_less(lb_kim, X_dtw + EPS)
    np.testing.assert_array_less(lb_keogh, X_dtw_window + EPS)
    np.testing.assert_array_less(lb_improved, X_dtw_window + EPS)
    np.testing.assert_array_less(lb_keogh, lb_improved + EPS)
Test that the expected inequalities are verified.
pyts/metrics/tests/test_lower_bounds.py