code: def _check_params_predict(
      model, X, test_methods, check_params_fun=None, formats=None
  ):
      if formats is None:
          formats = all_formats
      # serialize to all all_formats
      for fmt in formats:
          getattr(model, "to_{}".format(fmt))(
              os.path.join(
                  tmp_dir, "{}.{}".format(model.__class__.__name__, fmt)
              )
          )
  
      # loaded models should have same model params
      # and provide the same predictions
      for fmt in formats:
          sm = getattr(model, "from_{}".format(fmt))(
              os.path.join(
                  tmp_dir, "{}.{}".format(model.__class__.__name__, fmt)
              )
          )
  
          # make sure it's restored to the same class
          assert isinstance(sm, model.__class__)
  
          # test that predictions/transforms etc. are the same
          for method in test_methods:
              m1 = getattr(model, method)
              m2 = getattr(sm, method)
              numpy.testing.assert_equal(m1(X), m2(X))
  
          model_params = model._get_model_params()
          if check_params_fun is None:
              # check that the model-params are the same
              for p in model_params.keys():
                  numpy.testing.assert_equal(
                      getattr(model, p), getattr(sm, p)
                  )
          else:
              numpy.testing.assert_equal(
                  check_params_fun(model), check_params_fun(sm)
              )
  
          # check that hyper-params are the same
          hyper_params = model.get_params()
          for p in hyper_params.keys():
              numpy.testing.assert_equal(
                  getattr(model, p), getattr(sm, p)
              )
  
      clear_tmp()
  
imports: import os
  from glob import glob
  import numpy
  import pytest
  from sklearn.exceptions import NotFittedError
  from tslearn import hdftools
  from tslearn.preprocessing import TimeSeriesScalerMeanVariance
  from tslearn.neighbors import KNeighborsTimeSeries, KNeighborsTimeSeriesClassifier
  from tslearn.shapelets import LearningShapelets
  from tslearn.clustering import KShape, TimeSeriesKMeans, KernelKMeans
  from tslearn.generators import random_walks
  from tslearn.piecewise import PiecewiseAggregateApproximation, SymbolicAggregateApproximation, OneD_SymbolicAggregateApproximation
label_desc: Use image node_id 5 for calling a global function with example usage: _check_params_predict(model, X, test_methods, check_params_fun, formats) without return types