class_docstr: Create centroid.
class_docstr_tok: ["Create","centroid","."]
docstr: Create the centroid for each class.
docstr_tok: ["Create","the","centroid","for","each","class","."]
code: def create_centroid(self, X, y):
      """Create the centroid for each class."""
      _, ncols, _ = X.shape
      cols = ["dim_" + str(i) for i in range(ncols)]
      ts = X
      centroids = []
  
      # le = LabelEncoder()
      # y_ind = le.fit_transform(y)
  
      for dim in range(ts.shape[1]):
          train = ts[:, dim, :]
          clf = NearestCentroid(train)
          clf = NearestCentroid(shrink_threshold=self.shrink)
          clf.fit(train, y)
          centroids.append(clf.centroids_)
  
      centroid_frame = from_3d_numpy_to_nested(
          np.stack(centroids, axis=1), column_names=cols
      )
      centroid_frame["class_vals"] = clf.classes_
  
      return centroid_frame.reset_index(drop=True)
  
imports: import itertools
  import time
  import numpy
  import pandas
  from sklearn.neighbors import NearestCentroid
  from sktime.datatypes import convert
  from sktime.datatypes._panel._convert import from_3d_numpy_to_nested
  from sktime.transformations.base import BaseTransformer
label_desc: Use image node_id 2 for calling the _shrunk_centroid obj's underlying member method code with example usage: obj.create_centroid(X, y) and returns: centroid_frame