code: def mae(predictions, truth, missing="error"):
      """
      Compute MAE (mean absolute error).  This is computed as:
  
      .. math::
          \\sum_{r_{ui} \\in R} \\left|r_{ui} - s(i|u)\\right|
  
      When used with :func:`user_metric`, or on series grouped by user, it computes
      a per-user MAE; when applied to an entire prediction frame, it computes global
      MAE.  It does not do any fallbacks; if you want to compute MAE with fallback
      predictions (e.g. usign a bias model when a collaborative filter cannot predict),
      generate predictions with :class:`lenskit.algorithms.basic.Fallback`.
  
      Args:
          predictions(pandas.Series): the predictions
          truth(pandas.Series): the ground truth ratings from data
          missing(string):
              how to handle predictions without truth. Can be one of
              ``'error'`` or ``'ignore'``.
  
      Returns:
          double: the mean absolute approximation error
      """
  
      # force into series
      predictions = pd.Series(predictions)
      truth = pd.Series(truth)
  
      predictions, truth = predictions.align(truth, join="left")
      _check_missing(truth, missing)
  
      diff = predictions - truth
  
      adiff = diff.apply(np.abs)
      return adiff.mean()
  
imports: import numpy
  import pandas
label_desc: Use image node_id 3 for calling a global function with example usage: mae(predictions, truth, missing) and returns: adiff