code: def mad(costs, median=None):
      """Apply the robust median absolute deviation (MAD)
      to measure the inconsistency/variability of the
      rotation costs.
  
      Parameters
      ----------
      costs : list of rotation costs
      median: float (default=None), MAD median
  
      Returns
      -------
      z : float
          the modified z scores
      """
      costs_ = np.reshape(costs, (-1, 1))
      median = np.nanmedian(costs_) if median is None else median
      diff = np.abs(costs_ - median)
      return np.ravel(0.6745 * diff / np.median(diff)), median
  
imports: from __future__ import division
  from __future__ import print_function
  import multiprocessing
  from itertools import combinations
  from multiprocessing import Pool
  import numba
  import numpy
  from sklearn.preprocessing import MinMaxScaler, RobustScaler
  from sklearn.utils import check_array
  from .base import BaseDetector
label_desc: Use image node_id 1 for calling a global function with example usage: mad(costs, median) and returns: np,  median