code: def grabocka_params_to_shapelet_size_dict(
      n_ts, ts_sz, n_classes, l, r
  ):
      """Compute number and length of shapelets.
  
       This function uses the heuristic from [1]_.
  
      Parameters
      ----------
      n_ts: int
          Number of time series in the dataset
      ts_sz: int
          Length of time series in the dataset
      n_classes: int
          Number of classes in the dataset
      l: float
          Fraction of the length of time series to be used for base shapelet
          length
      r: int
          Number of different shapelet lengths to use
  
      Returns
      -------
      dict
          Dictionary giving, for each shapelet length, the number of such
          shapelets to be generated
  
      Examples
      --------
      >>> d = grabocka_params_to_shapelet_size_dict(
      ...         n_ts=100, ts_sz=100, n_classes=3, l=0.1, r=2)
      >>> keys = sorted(d.keys())
      >>> print(keys)
      [10, 20]
      >>> print([d[k] for k in keys])
      [4, 4]
  
  
      References
      ----------
      .. [1] J. Grabocka et al. Learning Time-Series Shapelets. SIGKDD 2014.
      """
      base_size = int(l * ts_sz)
      base_size = max(base_size, 1)
      r = min(r, ts_sz)
      d = {}
      for sz_idx in range(r):
          shp_sz = base_size * (sz_idx + 1)
          n_shapelets = int(
              numpy.log10(n_ts * (ts_sz - shp_sz + 1) * (n_classes - 1))
          )
          n_shapelets = max(1, n_shapelets)
          d[shp_sz] = n_shapelets
      return d
  
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 2 for calling a global function with example usage: grabocka_params_to_shapelet_size_dict(n_ts, ts_sz, n_classes, l, r) and returns: d