class_docstr: KShape clustering for time series.
  
  KShape was originally presented in [1]_.
  
  Parameters
  ----------
  n_clusters : int (default: 3)
      Number of clusters to form.
  
  max_iter : int (default: 100)
      Maximum number of iterations of the k-Shape algorithm.
  
  tol : float (default: 1e-6)
      Inertia variation threshold. If at some point, inertia varies less than
      this threshold between two consecutive
      iterations, the model is considered to have converged and the algorithm
      stops.
  
  n_init : int (default: 1)
      Number of time the k-Shape algorithm will be run with different
      centroid seeds. The final results will be the
      best output of n_init consecutive runs in terms of inertia.
  
  verbose : bool (default: False)
      Whether or not to print information about the inertia while learning
      the model.
  
  random_state : integer or numpy.RandomState, optional
      Generator used to initialize the centers. If an integer is given, it
      fixes the seed. Defaults to the global
      numpy random number generator.
  
  init : {'random' or ndarray} (default: 'random')
      Method for initialization.
      'random': choose k observations (rows) at random from data for the
      initial centroids.
      If an ndarray is passed, it should be of shape (n_clusters, ts_size, d)
      and gives the initial centers.
  
  Attributes
  ----------
  cluster_centers_ : numpy.ndarray of shape (sz, d).
      Centroids
  
  labels_ : numpy.ndarray of integers with shape (n_ts, ).
      Labels of each point
  
  inertia_ : float
      Sum of distances of samples to their closest cluster center.
  
  n_iter_ : int
      The number of iterations performed during fit.
  
  Notes
  -----
      This method requires a dataset of equal-sized time series.
  
  Examples
  --------
  >>> from tslearn.generators import random_walks
  >>> X = random_walks(n_ts=50, sz=32, d=1)
  >>> X = TimeSeriesScalerMeanVariance(mu=0., std=1.).fit_transform(X)
  >>> ks = KShape(n_clusters=3, n_init=1, random_state=0).fit(X)
  >>> ks.cluster_centers_.shape
  (3, 32, 1)
  
  References
  ----------
  .. [1] J. Paparrizos & L. Gravano. k-Shape: Efficient and Accurate
     Clustering of Time Series. SIGMOD 2015. pp. 1855-1870.
docstr: Predict the closest cluster each time series in X belongs to.
  
  Parameters
  ----------
  X : array-like of shape=(n_ts, sz, d)
      Time series dataset to predict.
  
  Returns
  -------
  labels : array of shape=(n_ts, )
      Index of the cluster each sample belongs to.
docstr_tok: ["Predict","the","closest","cluster","each","time","series","in","X","belongs","to",".","Parameters","--","--","--","--","--","X",":","array-like","of","shape=","(","n_ts",",","sz",",","d",")","Time","series","dataset","to","predict",".","Returns","--","--","--","-","labels",":","array","of","shape=","(","n_ts",",",")","Index","of","the","cluster","each","sample","belongs","to","."]
code: def predict(self, X):
      """Predict the closest cluster each time series in X belongs to.
  
      Parameters
      ----------
      X : array-like of shape=(n_ts, sz, d)
          Time series dataset to predict.
  
      Returns
      -------
      labels : array of shape=(n_ts, )
          Index of the cluster each sample belongs to.
      """
      X = check_array(X, allow_nd=True)
      check_is_fitted(
          self, ["cluster_centers_", "norms_", "norms_centroids_"]
      )
  
      X_ = check_dims(X, X_fit_dims=self.cluster_centers_.shape)
      X_ = TimeSeriesScalerMeanVariance(mu=0.0, std=1.0).fit_transform(
          X_
      )
      dists = self._cross_dists(X_)
      return dists.argmin(axis=1)
  
imports: from sklearn.base import ClusterMixin
  from sklearn.utils import check_random_state
  import numpy
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_is_fitted
  from tslearn.preprocessing import TimeSeriesScalerMeanVariance
  from tslearn.utils import to_time_series_dataset, check_dims
  from tslearn.metrics import cdist_normalized_cc, y_shifted_sbd_vec
  from tslearn.bases import BaseModelPackage, TimeSeriesBaseEstimator
  from .utils import TimeSeriesCentroidBasedClusteringMixin, _check_no_empty_cluster, _compute_inertia, _check_initial_guess, EmptyClusterError
label_desc: Use image node_id 10 for calling the KShape obj's underlying member method code with example usage: obj.predict(X) and returns: dists