class_docstr: Simple regression evaluation.
  
  Args:
      config: a :class:`SimpleEvaluationConfig`
class_docstr_tok: ["Simple","regression","evaluation",".","Args",":","config",":","a",":","class",":","`","SimpleEvaluationConfig","`"]
code: def evaluate_samples(self, samples, eval_key=None, missing=None):
      metric = self.config._metric
  
      if metric == "squared_error":
          error_fcn = lambda yp, yt: (yp - yt) ** 2
      elif metric == "absolute_error":
          error_fcn = lambda yp, yt: abs(yp - yt)
      elif callable(metric):
          error_fcn = metric
      else:
          raise ValueError(
              "Unsupported metric '%s'. The supported values are %s or a "
              "function that accepts two scalar arguments `(ypred, ytrue)`"
              % (metric, ("squared_error", "absolute_error"))
          )
  
      pred_field = self.config.pred_field
      gt_field = self.config.gt_field
      is_frame_field = samples._is_frame_field(gt_field)
  
      gt = gt_field + ".value"
      pred = pred_field + ".value"
      pred_conf = pred_field + ".confidence"
      _id = "id" if not is_frame_field else "frames.id"
  
      ytrue, ypred, confs, ids = samples.values(
          [gt, pred, pred_conf, _id]
      )
  
      if is_frame_field:
          _ytrue = list(itertools.chain.from_iterable(ytrue))
          _ypred = list(itertools.chain.from_iterable(ypred))
          _confs = list(itertools.chain.from_iterable(confs))
          _ids = list(itertools.chain.from_iterable(ids))
      else:
          _ytrue = ytrue
          _ypred = ypred
          _confs = confs
          _ids = ids
  
      results = RegressionResults(
          samples,
          self.config,
          eval_key,
          _ytrue,
          _ypred,
          confs=_confs,
          ids=_ids,
          missing=missing,
          backend=self,
      )
  
      if eval_key is None:
          return results
  
      def compute_error(yp, yt):
          if missing is not None:
              if yp is None:
                  yp = missing
  
              if yt is None:
                  yt = missing
  
          try:
              return error_fcn(yp, yt)
          except:
              return None
  
      if is_frame_field:
          frame_errors = [
              list(map(compute_error, yp, yt))
              for yp, yt in zip(ypred, ytrue)
          ]
          sample_errors = [_safe_mean(e) for e in frame_errors]
  
          eval_frame = samples._FRAMES_PREFIX + eval_key
  
          # Sample-level errors
          samples.set_values(eval_key, sample_errors)
  
          # Per-frame errors
          samples.set_values(eval_frame, frame_errors)
      else:
          errors = list(map(compute_error, ypred, ytrue))
  
          # Per-sample errors
          samples.set_values(eval_key, errors)
  
      return results
  
imports: from copy import deepcopy
  import inspect
  import itertools
  import logging
  import numbers
  import numpy
  import sklearn.metrics
  from tabulate import tabulate
  import eta.core.utils
  import fiftyone
  import fiftyone.core.evaluation
  import fiftyone.core.fields
  import fiftyone.core.labels
  import fiftyone.core.plots
  import fiftyone.core.utils
  import fiftyone.core.validation
label_desc: Use image node_id 1 for calling the SimpleEvaluation obj's underlying member method code with example usage: obj.evaluate_samples(samples, eval_key, missing) and returns: results, results, error_fcn, None