code: def calculate_distance(
      vec1: np.array, vec2: np.array, range_per_feature: np.array
  ) -> float:
      """Calculate distance between two vectors using Gower's method.
  
      Parameters
      ----------
      vec1 : np.array
          First vector.
      vec2 : np.array
          Second vector.
      range_per_feature : np.array
          Range of each numeric feature or -1 for categorical.
  
      Returns
      -------
      float
       representing Gower's distance between the two vectors.
      """
      sum_dist = 0
      num_features = 0
      for col_index in range(len(vec1)):
          if range_per_feature[col_index] == -1:
              # categorical feature
              if pd.isnull(vec1[col_index]) and pd.isnull(
                  vec2[col_index]
              ):
                  sum_dist += 0
              elif (
                  pd.isnull(vec1[col_index])
                  or pd.isnull(vec2[col_index])
              ) or vec1[col_index] != vec2[col_index]:
                  sum_dist += 1
              num_features += 1
          else:
              # numeric feature
              if pd.isnull(vec1[col_index]) or pd.isnull(
                  vec2[col_index]
              ):
                  continue
              sum_dist += (
                  np.abs(vec1[col_index] - vec2[col_index])
                  / range_per_feature[col_index]
              )
              num_features += 1
  
      if num_features == 0:
          return np.nan
      return sum_dist / num_features
  
file_path: deepchecks/deepchecks/utils/gower_distance.py
imports: from typing import Hashable, List
  import numpy
  import pandas
  from deepchecks.utils.array_math import fast_sum_by_row
label_desc: Use image node_id 4 for calling a global function with example usage: calculate_distance(vec1, vec2, range_per_feature) and returns: unknown, np