class_docstr: Create distance matrix.
class_docstr_tok: ["Create","distance","matrix","."]
docstr: Create distance matrix.
docstr_tok: ["Create","distance","matrix","."]
code: def distance(self, centroid_frame):
      """Create distance matrix."""
      distance_pair = list(
          itertools.combinations(range(0, centroid_frame.shape[0]), 2)
      )
      # exit()
  
      map_cls = centroid_frame.class_vals.to_dict()
      distance_frame = pd.DataFrame()
      for class_ in distance_pair:
          class_pair = []
          # calculate the distance of centroid here
          for _, (q, t) in enumerate(
              zip(
                  centroid_frame.drop(["class_vals"], axis=1).iloc[
                      class_[0], :
                  ],
                  centroid_frame.iloc[class_[1], :],
              )
          ):
              # print(eu_dist(q.values, t.values))
              class_pair.append(_eu_dist(q.values, t.values))
              dict_ = {
                  f"Centroid_{map_cls[class_[0]]}_{map_cls[class_[1]]}": class_pair
              }
              # print(class_[0])
  
          distance_frame = pd.concat(
              [distance_frame, pd.DataFrame(dict_)], axis=1
          )
  
      return distance_frame
  
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 1 for calling the _distance_matrix obj's underlying member method code with example usage: obj.distance(centroid_frame) and returns: distance_frame