def test_shapes_cross_entropy(X, y, params, n_shapelets_desired):
    """Test that the attributes and returned arrays have the expected shapes"""
    n_samples = X.shape[0]
    if 'max_iter' not in params.keys():
        params['max_iter'] = 0
    clf = CrossEntropyLearningShapelets(**params)

    # Training phase
    clf.fit(X, y)
    n_classes = 1 if len(clf.classes_) == 2 else len(clf.classes_)
    np.testing.assert_array_equal(clf.classes_, y)
    assert clf.shapelets_.shape == (n_shapelets_desired,)
    assert clf.coef_.shape == (n_classes, n_shapelets_desired)
    assert clf.intercept_.shape == (n_classes,)
    assert clf.n_iter_ <= clf.max_iter

    # Test phase
    X_new = clf.decision_function(X)
    y_proba = clf.predict_proba(X)
    y_pred = clf.predict(X)
    if n_classes == 1:
        assert X_new.shape == (n_samples,)
        assert y_proba.shape == (n_samples, 2)
    else:
        assert X_new.shape == (n_samples, n_classes)
        assert y_proba.shape == (n_samples, n_classes)
    assert y_pred.shape == (n_samples,)
Test that the attributes and returned arrays have the expected shapes
pyts/classification/tests/test_learning_shapelets.py