code: def _kmeans_init_shapelets(X, n_shapelets, shp_len, n_draw=10000):
      n_ts, sz, d = X.shape
      indices_ts = numpy.random.choice(n_ts, size=n_draw, replace=True)
      indices_time = numpy.array(
          [
              numpy.random.choice(ts_size(ts) - shp_len + 1, size=1)[0]
              for ts in X[indices_ts]
          ]
      )
      subseries = numpy.zeros((n_draw, shp_len, d))
      for i in range(n_draw):
          subseries[i] = X[
              indices_ts[i], indices_time[i] : indices_time[i] + shp_len
          ]
      return (
          TimeSeriesKMeans(
              n_clusters=n_shapelets, metric="euclidean", verbose=False
          )
          .fit(subseries)
          .cluster_centers_
      )
  
imports: from tensorflow.keras.models import Model, model_from_json
  from tensorflow.keras.layers import InputSpec, Dense, Conv1D, Layer, Input, concatenate, add
  from tensorflow.keras.metrics import categorical_accuracy, categorical_crossentropy, binary_accuracy, binary_crossentropy
  from tensorflow.keras.utils import to_categorical
  from sklearn.base import ClassifierMixin, TransformerMixin
  from sklearn.utils import check_array, check_X_y
  from sklearn.utils.validation import check_is_fitted
  from sklearn.utils.multiclass import unique_labels
  from tensorflow.keras.regularizers import l2
  from tensorflow.keras.initializers import Initializer
  import tensorflow.keras.backend
  import numpy
  import tensorflow
  import warnings
  from ..utils import to_time_series_dataset, check_dims, ts_size
  from ..bases import BaseModelPackage, TimeSeriesBaseEstimator
  from ..clustering import TimeSeriesKMeans
  from ..preprocessing import TimeSeriesScalerMinMax
label_desc: Use image node_id 1 for calling a global function with example usage: _kmeans_init_shapelets(X, n_shapelets, shp_len, n_draw) and returns: TimeSeriesKMeans