code: def _get_avg_regression_error(Y1, Y2):
      """Returns the negative prediction error."""
      if len(Y1) != len(Y2):
          raise ValueError(
              "Lenghts of Y1 (%d), and Y2 (%d) should be the same."
              % (len(Y1), len(Y2))
          )
      num_data = float(len(Y1))
      differences = np.array(Y1) - np.array(Y2)
      finite_diffs = differences[np.isfinite(differences)]
      if len(finite_diffs) > 0:
          max_finite_diff = finite_diffs.max()
      else:
          max_finite_diff = 10.0
      differences[np.logical_not(np.isfinite(differences))] = np.clip(
          10 * max_finite_diff, 10.0, 100.0
      )
      diff_sq = np.linalg.norm(differences) ** 2
      ret = diff_sq / num_data
      ret = min(ret, 100.0)
      return ret
  
file_path: dragonfly/examples/tree_reg/skltree.py
imports: from __future__ import print_function
  import numpy
  from sklearn import ensemble
label_desc: Use image node_id 2 for calling a global function with example usage: _get_avg_regression_error(Y1, Y2) and returns: ret