code: def monotonicity_metric(model, x, coefs, base):
      """This metric measures the effect of individual features on model performance by evaluating the effect on
      model performance of incrementally adding each attribute in order of increasing importance. As each feature
      is added, the performance of the model should correspondingly increase, thereby resulting in monotonically
      increasing model performance. [#]_
  
      References:
          .. [#] `Ronny Luss, Pin-Yu Chen, Amit Dhurandhar, Prasanna Sattigeri, Karthikeyan Shanmugam, and
             Chun-Chen Tu. Generating Contrastive Explanations with Monotonic Attribute Functions. CoRR abs/1905.13565. 2019.
             <https://arxiv.org/pdf/1905.12698.pdf>`_
  
      Args:
          model: Trained classifier, such as a ScikitClassifier that implements
              a predict() and a predict_proba() methods.
          x (numpy.ndarray): row of data.
          coefs (numpy.ndarray): coefficients (weights) corresponding to attribute importance.
          base ((numpy.ndarray): base (default) values of attributes
  
      Returns:
          bool: True if the relationship is monotonic.
      """
      # find predicted class
      pred_class = np.argmax(
          model.predict_proba(x.reshape(1, -1)), axis=1
      )[0]
  
      x_copy = base.copy()
  
      # find indexs of coefficients in increasing order of value
      ar = np.argsort(coefs)
      pred_probs = np.zeros(x.shape[0])
      for ind in np.nditer(ar):
          x_copy[ind] = x[ind]
          x_copy_pr = model.predict_proba(x_copy.reshape(1, -1))
          pred_probs[ind] = x_copy_pr[0][pred_class]
  
      return np.all(np.diff(pred_probs[ar]) >= 0)
  
label_desc: Use image node_id 2 for calling a global function with example usage: monotonicity_metric(model, x, coefs, base) and returns: np