code: def test_shapes(X, y, params, n_shapelets_desired, n_tasks):
      """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 = LearningShapelets(**params)
  
      # Training phase
      clf.fit(X, y)
      n_classes = len(clf.classes_) if len(clf.classes_) > 2 else 1
      np.testing.assert_array_equal(clf.classes_, y)
      if clf._multi_class in ("binary", "multinomial"):
          assert clf.shapelets_.shape == (1, n_shapelets_desired)
          assert clf.coef_.shape == (n_classes, n_shapelets_desired)
          assert clf.intercept_.shape == (n_classes,)
          assert clf.n_iter_.shape == (1,)
      else:
          assert clf.shapelets_.shape == (n_tasks, n_shapelets_desired)
          assert clf.coef_.shape == (n_tasks, n_shapelets_desired)
          assert clf.intercept_.shape == (n_tasks,)
          assert clf.n_iter_.shape == (n_tasks,)
  
      # Test phase
      X_new = clf.decision_function(X)
      y_proba = clf.predict_proba(X)
      y_pred = clf.predict(X)
      if clf._multi_class == "binary":
          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,)
  
imports: import numpy
  import pytest
  import re
  from sklearn.exceptions import ConvergenceWarning
  from pyts.classification.learning_shapelets import CrossEntropyLearningShapelets
  from pyts.classification import LearningShapelets
  from pyts.classification.learning_shapelets import _expit, _xlogy, _softmin, _softmin_grad, _softmax, _derive_shapelet_distances, _derive_all_squared_distances, _reshape_list_shapelets, _reshape_array_shapelets, _loss, _grad_weights, _grad_shapelets
label_desc: Use image node_id 19 for calling a global function with example usage: test_shapes(X, y, params, n_shapelets_desired, n_tasks) without return types