docs: def auc(x, y, reorder=False): #from sklearn, http://scikit-learn.org, licensed under BSD License
      """Compute Area Under the Curve (AUC) using the trapezoidal rule
  
      This is a general fuction, given points on a curve.  For computing the area
      under the ROC-curve, see :func:`auc_score`.
  
      Parameters
      ----------
      x : array, shape = [n]
          x coordinates.
  
      y : array, shape = [n]
          y coordinates.
  
      reorder : boolean, optional (default=False)
          If True, assume that the curve is ascending in the case of ties, as for
          an ROC curve. If the curve is non-ascending, the result will be wrong.
  
      Returns
      -------
      auc : float
  
      Examples
      --------
      >>> import numpy as np
      >>> from sklearn import metrics
      >>> y = np.array([1, 1, 2, 2])
      >>> pred = np.array([0.1, 0.4, 0.35, 0.8])
      >>> fpr, tpr, thresholds = metrics.roc_curve(y, pred, pos_label=2)
      >>> metrics.auc(fpr, tpr)
      0.75
  
      See also
      --------
      auc_score : Computes the area under the ROC curve
  
      """
      if np is None:
          raise ImportError("No numpy installed")
  
      # XXX: Consider using  ``scipy.integrate`` instead, or moving to
      # ``utils.extmath``
      if not isinstance(x, np.ndarray): x = np.array(x)
      if not isinstance(x, np.ndarray): y = np.array(y)
      if x.shape[0] < 2:
          raise ValueError('At least 2 points are needed to compute'
                           ' area under curve, but x.shape = %s' % x.shape)
  
      if reorder:
          # reorder the data points according to the x axis and using y to
          # break ties
          x, y = np.array(sorted(points for points in zip(x, y))).T
          h = np.diff(x)
      else:
          h = np.diff(x)
          if np.any(h < 0):
              h *= -1
              assert not np.any(h < 0), ("Reordering is not turned on, and "
                                         "The x array is not increasing: %s" % x)
  
      area = np.sum(h * (y[1:] + y[:-1])) / 2.0
      return area