code: def check_classifiers_train(
      name, classifier_orig, readonly_memmap=False, X_dtype="float64"
  ):
      # Case of shapelet models
      if name in ["LearningShapelets", "TimeSeriesMLPClassifier"]:
          X_m, y_m = _create_large_ts_dataset()
          classifier_orig = clone(classifier_orig)
          classifier_orig.max_iter = 1000
      else:
          X_m, y_m = _create_small_ts_dataset()
      X_m = X_m.astype(X_dtype)
  
      X_m, y_m = shuffle(X_m, y_m, random_state=7)
  
      X_m = TimeSeriesScalerMeanVariance().fit_transform(X_m)
  
      # generate binary problem from multi-class one
      y_b = y_m[y_m != 2]
      X_b = X_m[y_m != 2]
  
      # We will test for both binary and multiclass case
      problems = [(X_b, y_b), (X_m, y_m)]
  
      tags = classifier_orig._get_tags()
  
      for X, y in problems:
          classes = np.unique(y)
          n_classes = len(classes)
          n_samples, n_features, dim = X.shape
          classifier = clone(classifier_orig)
          X = pairwise_estimator_convert_X(X, classifier)
  
          set_random_state(classifier)
          # raises error on malformed input for fit
          if not tags["no_validation"]:
              with assert_raises(
                  ValueError,
                  msg="The classifier {} does not "
                  "raise an error when incorrect/malformed input "
                  "data for fit is passed. The number of training "
                  "examples is not the same as the number of labels. "
                  "Perhaps use check_X_y in fit.".format(name),
              ):
                  classifier.fit(X, y[:-1])
  
          # fit with lists
          classifier.fit(X.tolist(), y.tolist())
          assert hasattr(classifier, "classes_")
          y_pred = classifier.predict(X)
  
          assert y_pred.shape == (n_samples,)
  
          # training set performance
          if not tags["poor_score"]:
              assert accuracy_score(y, y_pred) > 0.83
  
          # raises error on malformed input for predict
          msg_pairwise = (
              "The classifier {} does not raise an error when shape of X in "
              " {} is not equal to (n_test_samples, n_training_samples)"
          )
          msg = (
              "The classifier {} does not raise an error when the number of "
              "features in {} is different from the number of features in "
              "fit."
          )
  
          if not tags["no_validation"]:
              if bool(getattr(classifier, "_pairwise", False)):
                  with assert_raises(
                      ValueError,
                      msg=msg_pairwise.format(name, "predict"),
                  ):
                      classifier.predict(X.reshape(-1, 1))
              else:
                  if not tags["allow_variable_length"]:
                      with assert_raises(
                          ValueError, msg=msg.format(name, "predict")
                      ):
                          classifier.predict(X.T)
                  else:
                      with assert_raises(
                          ValueError, msg=msg.format(name, "predict")
                      ):
                          classifier.predict(X.reshape((-1, 5, 2)))
          if hasattr(classifier, "decision_function"):
              try:
                  # decision_function agrees with predict
                  decision = classifier.decision_function(X)
                  if n_classes == 2:
                      if not tags["multioutput_only"]:
                          assert decision.shape == (n_samples,)
                      else:
                          assert decision.shape == (n_samples, 1)
                      dec_pred = (decision.ravel() > 0).astype(int)
                      assert_array_equal(dec_pred, y_pred)
                  else:
                      assert decision.shape == (n_samples, n_classes)
                      assert_array_equal(
                          np.argmax(decision, axis=1), y_pred
                      )
  
                  # raises error on malformed input for decision_function
                  if not tags["no_validation"]:
                      error_msg = msg_pairwise.format(
                          name, "decision_function"
                      )
                      if bool(getattr(classifier, "_pairwise", False)):
                          with assert_raises(ValueError, msg=error_msg):
                              classifier.decision_function(
                                  X.reshape(-1, 1)
                              )
                      else:
                          if not tags["allow_variable_length"]:
                              with assert_raises(
                                  ValueError, msg=error_msg
                              ):
                                  classifier.decision_function(X.T)
                          else:
                              with assert_raises(
                                  ValueError, msg=error_msg
                              ):
                                  classifier.decision_function(
                                      X.reshape((-1, 5, 2))
                                  )
              except NotImplementedError:
                  pass
  
          if hasattr(classifier, "predict_proba"):
              # predict_proba agrees with predict
              y_prob = classifier.predict_proba(X)
              assert y_prob.shape == (n_samples, n_classes)
              assert_array_equal(np.argmax(y_prob, axis=1), y_pred)
              # check that probas for all classes sum to one
              assert_array_almost_equal(
                  np.sum(y_prob, axis=1), np.ones(n_samples)
              )
              if not tags["no_validation"]:
                  # raises error on malformed input for predict_proba
                  if bool(getattr(classifier_orig, "_pairwise", False)):
                      with assert_raises(
                          ValueError,
                          msg=msg_pairwise.format(
                              name, "predict_proba"
                          ),
                      ):
                          classifier.predict_proba(X.reshape(-1, 1))
                  else:
                      if not tags["allow_variable_length"]:
                          with assert_raises(
                              ValueError,
                              msg=msg.format(name, "predict_proba"),
                          ):
                              classifier.predict_proba(X.T)
                      else:
                          with assert_raises(
                              ValueError,
                              msg=msg.format(name, "predict_proba"),
                          ):
                              classifier.predict_proba(
                                  X.reshape((-1, 5, 2))
                              )
              if hasattr(classifier, "predict_log_proba"):
                  # predict_log_proba is a transformation of predict_proba
                  y_log_prob = classifier.predict_log_proba(X)
                  assert_allclose(
                      y_log_prob, np.log(y_prob), 8, atol=1e-9
                  )
                  assert_array_equal(
                      np.argsort(y_log_prob), np.argsort(y_prob)
                  )
  
imports: from tslearn.generators import random_walk_blobs
  from tslearn.preprocessing import TimeSeriesScalerMeanVariance
  import sklearn
  import warnings
  from sklearn.base import clone
  from sklearn.base import is_classifier, is_outlier_detector, is_regressor
  from sklearn.base import ClusterMixin
  from sklearn.exceptions import DataConversionWarning
  from sklearn.datasets import make_blobs
  from sklearn.metrics.pairwise import rbf_kernel, linear_kernel, pairwise_distances
  from sklearn.utils import shuffle
  from sklearn.utils.estimator_checks import check_classifiers_predictions, check_fit2d_1sample, check_fit2d_1feature, check_fit1d, check_get_params_invariance, check_set_params, check_dict_unchanged, check_dont_overwrite_parameters, check_estimators_data_not_an_array, check_fit2d_predict1d, check_methods_subset_invariance, check_regressors_int
  from sklearn.exceptions import SkipTestWarning
  from sklearn.utils.estimator_checks import _yield_classifier_checks, _yield_regressor_checks, _yield_transformer_checks, _yield_clustering_checks, _yield_outliers_checks, _is_pairwise_metric
  from sklearn.metrics import adjusted_rand_score, accuracy_score
  from sklearn.model_selection import ShuffleSplit
  from sklearn.model_selection._validation import _safe_split
  from sklearn.pipeline import make_pipeline
  from tslearn.clustering import TimeSeriesKMeans
  import warnings
  import numpy
label_desc: Use image node_id 10 for calling a global function with example usage: check_classifiers_train(name, classifier_orig, readonly_memmap, X_dtype) without return types