code: def get_estimators(type_filter="all"):
      """Return a list of classes that inherit from `sklearn.BaseEstimator`.
      This code is based on `sklearn.utils.testing.all_estimators`.
  
      Parameters
      ----------
      type_filter : str (default: 'all')
          A value in ['all', 'classifier', 'transformer', 'cluster'] which
          defines which type of estimators to retrieve
  
      Returns
      -------
      list
          Collection of estimators of the type specified in `type_filter`
      """
  
      if type_filter not in [
          "all",
          "classifier",
          "transformer",
          "cluster",
      ]:
          # TODO: make this exception more specific
          raise Exception(
              "type_filter should be element of "
              "['all', 'classifier', 'transformer', 'cluster']"
          )
  
      all_classes = _get_all_classes()
  
      # Filter out those that are not a subclass of `sklearn.BaseEstimator`
      all_classes = [
          c for c in set(all_classes) if issubclass(c[1], BaseEstimator)
      ]
  
      # get rid of abstract base classes
      all_classes = filter(lambda c: not is_abstract(c[1]), all_classes)
  
      # only keep those that are from tslearn
      all_classes = filter(lambda c: not is_sklearn(c[1]), all_classes)
  
      # Now filter out the estimators that are not of the specified type
      filters = {
          "all": [
              ClassifierMixin,
              RegressorMixin,
              TransformerMixin,
              ClusterMixin,
          ],
          "classifier": [ClassifierMixin],
          "transformer": [TransformerMixin],
          "cluster": [ClusterMixin],
      }[type_filter]
      filtered_classes = []
      for _class in all_classes:
          if any([issubclass(_class[1], mixin) for mixin in filters]):
              filtered_classes.append(_class)
  
      # Remove duplicates and return the list of remaining estimators
      return sorted(set(filtered_classes), key=itemgetter(0))
  
file_path: tslearn/tslearn/tests/test_estimators.py
imports: import tslearn
  import pkgutil
  import inspect
  from functools import partial
  from operator import itemgetter
  import sklearn
  from sklearn.base import BaseEstimator, ClassifierMixin, ClusterMixin, RegressorMixin, TransformerMixin
  from sklearn.exceptions import SkipTestWarning
  from sklearn.utils.estimator_checks import check_no_attributes_set_in_init, check_parameters_default_constructible, _maybe_skip
  from tslearn.tests.sklearn_patches import check_clustering, check_non_transf_est_n_iter, check_fit_idempotent, check_classifiers_classes, check_classifiers_train, check_estimators_pickle, check_supervised_y_2d, check_regressor_data_not_an_array, check_classifier_data_not_an_array, check_regressors_int_patched, check_classifiers_cont_target, check_pipeline_consistency, yield_all_checks, _create_large_ts_dataset
  from tslearn.shapelets import LearningShapelets
  import warnings
  import pytest
label_desc: Use image node_id 4 for calling a global function with example usage: get_estimators(type_filter) and returns: sorted