code: def mean_absolute_error(
      y_true, y_pred, sample_weight=None, multioutput="uniform_average"
  ):
      """Mean absolute error regression loss
  
      Read more in the :ref:`User Guide <mean_absolute_error>`.
  
      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 target values.
  
      sample_weight : array-like of shape = (n_samples), optional
          Sample weights.
  
      multioutput : string in ['raw_values', 'uniform_average']
          or array-like of shape (n_outputs)
          Defines aggregating of multiple output values.
          Array-like value defines weights used to average errors.
  
          'raw_values' :
              Returns a full set of errors in case of multioutput input.
  
          'uniform_average' :
              Errors of all outputs are averaged with uniform weight.
  
  
      Returns
      -------
      loss : float or ndarray of floats
          If multioutput is 'raw_values', then mean absolute error is returned
          for each output separately.
          If multioutput is 'uniform_average' or an ndarray of weights, then the
          weighted average of all output errors is returned.
  
          MAE output is non-negative floating point. The best value is 0.0.
  
      Examples
      --------
      >>> from sklearn.metrics import mean_absolute_error
      >>> y_true = [3, -0.5, 2, 7]
      >>> y_pred = [2.5, 0.0, 2, 8]
      >>> mean_absolute_error(y_true, y_pred)
      0.5
      >>> y_true = [[0.5, 1], [-1, 1], [7, -6]]
      >>> y_pred = [[0, 2], [-1, 2], [8, -5]]
      >>> mean_absolute_error(y_true, y_pred)
      0.75
      >>> mean_absolute_error(y_true, y_pred, multioutput='raw_values')
      array([ 0.5,  1. ])
      >>> mean_absolute_error(y_true, y_pred, multioutput=[0.3, 0.7])
      ... # doctest: +ELLIPSIS
      0.849...
      """
      y_type, y_true, y_pred, multioutput = _check_reg_targets(
          y_true, y_pred, multioutput
      )
      output_errors = np.average(
          np.abs(y_pred - y_true), weights=sample_weight, axis=0
      )
      if isinstance(multioutput, string_types):
          if multioutput == "raw_values":
              return output_errors
          elif multioutput == "uniform_average":
              # pass None as weights to np.average: uniform mean
              multioutput = None
  
      return np.average(output_errors, weights=multioutput)
  
file_path: catboost/contrib/python/scikit-learn/py2/sklearn/metrics/regression.py
imports: from __future__ import division
  import numpy
  from ..utils.validation import check_array, check_consistent_length
  from ..utils.validation import column_or_1d
  from ..externals.six import string_types
  import warnings
label_desc: Use image node_id 2 for calling a global function with example usage: mean_absolute_error(y_true, y_pred, sample_weight, multioutput) and returns: np, output_errors