def test_fit_transform(params):
    """Test that 'fit_transform' and 'fit' then 'transform' yield same res."""
    shapelet_1 = ShapeletTransform(random_state=42, **params)
    shapelet_2 = ShapeletTransform(random_state=42, **params)

    X_fit_transform = shapelet_1.fit_transform(X, y)
    X_fit_then_transform = shapelet_2.fit(X, y).transform(X)

    # Test that the transformation are identical
    np.testing.assert_allclose(X_fit_transform, X_fit_then_transform,
                               atol=1e-5, rtol=0.)

    # Test that the shapelets are identical
    for (shap_1, shap_2) in zip(shapelet_1.shapelets_, shapelet_2.shapelets_):
        np.testing.assert_allclose(shap_1, shap_2, atol=1e-5, rtol=0.)

    # Test that the remaining attributes are identical
    np.testing.assert_allclose(shapelet_1.scores_, shapelet_2.scores_,
                               atol=1e-5, rtol=0.)
    np.testing.assert_array_equal(shapelet_1.indices_, shapelet_2.indices_)
    shapelets_not_none = ((shapelet_1.window_range_ is not None) and
                          (shapelet_2.window_range_ is not None))
    if shapelets_not_none:
        np.testing.assert_array_equal(shapelet_1.window_range_,
                                      shapelet_2.window_range_)
Test that 'fit_transform' and 'fit' then 'transform' yield same res.
pyts/transformation/tests/test_shapelet_transform.py