code: def compute_curve(
      ys, decision_values, xfun, yfun, positive=True, presorted=False
  ):
      """Computes a curve based on contingency tables at different decision values.
  
      :param ys: true labels
      :type ys: iterable
      :param decision_values: decision values
      :type decision_values: iterable
      :param positive: positive label
      :param xfun: function to compute x values, based on contingency tables
      :type xfun: callable
      :param yfun: function to compute y values, based on contingency tables
      :type yfun: callable
      :param presorted: whether or not ys and yhat are already sorted
      :type presorted: bool
  
      :returns: the resulting curve, as a list of (x, y)-tuples
  
      """
      curve = []
      tables, _ = contingency_tables(
          ys, decision_values, positive, presorted
      )
      curve = list(map(lambda t: (xfun(t), yfun(t)), tables))
      return curve
  
imports: import math
  import operator
label_desc: Use image node_id 2 for calling a global function with example usage: compute_curve(ys, decision_values, xfun, yfun, positive, presorted) and returns: curve