class_docstr: Produces variety of regression metrics (including RMSE, R^2, etc).
class_docstr_tok: ["Produces","variety","of","regression","metrics","(","including","RMSE",",","R^2",",","etc",")","."]
docstr: Produces regression metrics.
  
  Args:
      X: Numpy array for X to compare predict function against.
      y: Numpy vector for y to compare predict function against.
      name: User-defined explanation name.
  
  Returns:
      An explanation object.
docstr_tok: ["Produces","regression","metrics",".","Args",":","X",":","Numpy","array","for","X","to","compare","predict","function","against",".","y",":","Numpy","vector","for","y","to","compare","predict","function","against",".","name",":","User-defined","explanation","name",".","Returns",":","An","explanation","object","."]
code: def explain_perf(self, X, y, name=None):
      """Produces regression metrics.
  
      Args:
          X: Numpy array for X to compare predict function against.
          y: Numpy vector for y to compare predict function against.
          name: User-defined explanation name.
  
      Returns:
          An explanation object.
      """
      if name is None:
          name = gen_name_from_class(self)
  
      y = clean_dimensions(y, "y")
      if y.ndim != 1:
          raise ValueError("y must be 1 dimensional")
  
      X, n_samples = preclean_X(
          X, self.feature_names, self.feature_types, len(y)
      )
  
      predict_fn, n_classes, _ = determine_classes(
          self.model, X, n_samples
      )
      if 0 <= n_classes:
          raise Exception(
              "Classification not supported by the RegressionPerf class"
          )
      predict_fn = unify_predict_fn(predict_fn, X, -1)
  
      X, feature_names, feature_types = unify_data(
          X, n_samples, self.feature_names, self.feature_types, True, 0
      )
  
      y = y.astype(np.float64, copy=False)
  
      scores = predict_fn(X)
  
      mse = mean_squared_error(y, scores)
      rmse = np.sqrt(mse)
      mae = mean_absolute_error(y, scores)
      r2 = r2_score(y, scores)
      residuals = y - scores
  
      # abs_residuals = np.abs(y - scores)
      counts, values = np.histogram(residuals, bins="doane")
  
      overall_dict = {
          "type": "perf_curve",
          "density": {"names": values, "scores": counts},
          "scores": scores,
          "mse": mse,
          "rmse": rmse,
          "mae": mae,
          "r2": r2,
          "residuals": residuals,
      }
      internal_obj = {"overall": overall_dict, "specific": None}
  
      return RegressionExplanation(
          "perf",
          internal_obj,
          feature_names=feature_names,
          feature_types=feature_types,
          name=name,
      )
  
file_path: interpret/python/interpret-core/interpret/perf/_regression.py
imports: from ..api.base import ExplainerMixin, ExplanationMixin
  from ..utils._explanation import gen_name_from_class
  from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
  import numpy
  from ..utils._clean_x import preclean_X
  from ..utils._clean_simple import clean_dimensions
  from ..utils._unify_predict import determine_classes, unify_predict_fn
  from ..utils._unify_data import unify_data
label_desc: Use image node_id 2 for calling the RegressionPerf obj's underlying member method code with example usage: obj.explain_perf(X, y, name) and returns: RegressionExplanation