code: def macro_averaged_mean_absolute_error(
      y_true, y_pred, *, sample_weight=None
  ):
      """Compute Macro-Averaged MAE for imbalanced ordinal classification.
  
      This function computes each MAE for each class and average them,
      giving an equal weight to each class.
  
      Read more in the :ref:`User Guide <macro_averaged_mean_absolute_error>`.
  
      .. versionadded:: 0.8
  
      Parameters
      ----------
      y_true : array-like of shape (n_samples,) or (n_samples, n_outputs)
          Ground truth (correct) target values.
  
      y_pred : array-like of shape (n_samples,) or (n_samples, n_outputs)
          Estimated targets as returned by a classifier.
  
      sample_weight : array-like of shape (n_samples,), default=None
          Sample weights.
  
      Returns
      -------
      loss : float or ndarray of floats
          Macro-Averaged MAE output is non-negative floating point.
          The best value is 0.0.
  
      Examples
      --------
      >>> import numpy as np
      >>> from sklearn.metrics import mean_absolute_error
      >>> from imblearn.metrics import macro_averaged_mean_absolute_error
      >>> y_true_balanced = [1, 1, 2, 2]
      >>> y_true_imbalanced = [1, 2, 2, 2]
      >>> y_pred = [1, 2, 1, 2]
      >>> mean_absolute_error(y_true_balanced, y_pred)
      0.5
      >>> mean_absolute_error(y_true_imbalanced, y_pred)
      0.25
      >>> macro_averaged_mean_absolute_error(y_true_balanced, y_pred)
      0.5
      >>> macro_averaged_mean_absolute_error(y_true_imbalanced, y_pred)
      0.16...
      """
      _, y_true, y_pred = _check_targets(y_true, y_pred)
      if sample_weight is not None:
          sample_weight = column_or_1d(sample_weight)
      else:
          sample_weight = np.ones(y_true.shape)
      check_consistent_length(y_true, y_pred, sample_weight)
      labels = unique_labels(y_true, y_pred)
      mae = []
      for possible_class in labels:
          indices = np.flatnonzero(y_true == possible_class)
  
          mae.append(
              mean_absolute_error(
                  y_true[indices],
                  y_pred[indices],
                  sample_weight=sample_weight[indices],
              )
          )
  
      return np.sum(mae) / len(mae)
  
file_path: imbalanced-learn/imblearn/metrics/_classification.py
imports: import functools
  import numbers
  import warnings
  from inspect import signature
  import numpy
  import scipy
  from sklearn.metrics import mean_absolute_error, precision_recall_fscore_support
  from sklearn.metrics._classification import _check_targets, _prf_divide
  from sklearn.preprocessing import LabelEncoder
  from sklearn.utils.multiclass import unique_labels
  from sklearn.utils.validation import check_consistent_length, column_or_1d
  from ..utils._param_validation import Interval, StrOptions, validate_params
label_desc: Use image node_id 7 for calling a global function with example usage: macro_averaged_mean_absolute_error(y_true, y_pred) and returns: unknown