def test_grad_shapelets(params, arr_desired):
    """Test that the actual gradient is the expected gradient."""
    params['sample_weight'] = params['sample_weight'].reshape(-1, 1)
    arr_actual = _grad_shapelets(
        X_bin, y_bin, n_classes, shapelets=shapelets, lengths=lengths,
        alpha=-100, intercept_scaling=1, **params
    )
    np.testing.assert_allclose(arr_actual, arr_desired, atol=1e-5, rtol=0.)
Test that the actual gradient is the expected gradient.
pyts/classification/tests/test_learning_shapelets.py