code: def evaluate_regressor(model, data, target="target", verbose=False):
      """
      Evaluate a CoreML regression model and compare against predictions
      from the original framework (for testing correctness of conversion).
  
      Parameters
      ----------
      model: MLModel or str
          A loaded MLModel or a path to a saved MLModel
  
      data: Dataframe
          Test data on which to evaluate the models
  
      target: str
         Name of the column in the dataframe to be compared against the prediction
  
      verbose: bool
         Set to true for a more verbose output.
  
      See Also
      --------
      evaluate_classifier
  
      Examples
      --------
      .. sourcecode:: python
  
          metrics = coremltools.utils.evaluate_regressor(
              spec, "data_and_predictions.csv", "target"
          )
          print(metrics)
          {"samples": 10, "rmse": 0.0, max_error: 0.0}
      """
      model = _get_model(model)
  
      if verbose:
          print("")
          print("Other Framework\t\tPredicted\t\tDelta")
  
      max_error = 0
      error_squared = 0
  
      for _, row in data.iterrows():
          input_dict = dict(row)
          _remove_invalid_keys(input_dict, model)
          predicted = model.predict(input_dict)[_to_unicode(target)]
          other_framework = row[target]
          delta = predicted - other_framework
  
          if verbose:
              print(
                  "{}\t\t\t\t{}\t\t\t{:0.4f}".format(
                      other_framework, predicted, delta
                  )
              )
  
          max_error = max(abs(delta), max_error)
          error_squared = error_squared + (delta * delta)
  
      ret = {
          "samples": len(data),
          "rmse": _math.sqrt(error_squared / len(data)),
          "max_error": max_error,
      }
  
      if verbose:
          print("results: {}".format(ret))
      return ret
  
imports: from collections.abc import Iterable
  from functools import lru_cache
  import math
  import os
  import shutil
  import subprocess
  import sys
  import tempfile
  from typing import Optional, Union
  import warnings
  import numpy
  import coremltools
  from coremltools import ComputeUnit
  from coremltools.converters.mil.mil.passes.defs.preprocess import NameSanitizer
  from coremltools.proto import Model_pb2
  import coremltools.proto.MIL_pb2
  from .._deps import _HAS_SCIPY
label_desc: Use image node_id 13 for calling a global function with example usage: evaluate_regressor(model, data, target, verbose) and returns: ret