code: def _transform(ground_truth, classifier, cost_matrix=None):
      """
      Transform given distributions from pandas type to numpy arrays, and _normalize them.
      Rearanges distributions, with totall data allocated of one.
      Generates matrix distance with respect to (ground_truth[i] - classifier[j])^2.
  
      Args:
          ground_truth (series): ground truth (correct) target values
          classifier (series,  dataframe, optional): pandas series estimated targets
              as returned by a model for binary, continuous and ordinal modes.
  
      Returns:
          initial_distribution, which is an processed ground_truth (numpy array)
          required_distribution, which is an processed classifier (numpy array)
          matrix_distance, which stores the distances between the cells of distributions (2d numpy array)
      """
      initial_distribution = ground_truth.to_numpy().astype(float)
      required_distribution = classifier.to_numpy().astype(float)
  
      _normalize(initial_distribution, required_distribution)
  
      if cost_matrix is not None:
          matrix_distance = cost_matrix
      else:
          matrix_distance = np.array(
              [
                  abs(i - required_distribution)
                  for i in initial_distribution
              ],
              dtype=float,
          )
      return (
          initial_distribution,
          required_distribution,
          matrix_distance,
      )
  
file_path: AIF360/aif360/metrics/ot_metric.py
imports: from typing import Union
  import pandas
  import numpy
  import ot
  from sklearn.preprocessing import LabelEncoder
label_desc: Use image node_id 2 for calling a global function with example usage: _transform(ground_truth, classifier, cost_matrix) and returns: initial_distribution,  required_distribution,  matrix_distance