code: def coefficient_of_determination(
      y_obs: np.ndarray,
      y_pred: np.ndarray,
      se_pred: Optional[np.ndarray] = None,
      eps: float = 1e-12,
  ) -> float:
      """Computes coefficient of determination, the proportion of variance in `y_obs`
      accounted for by predictions `y_pred`.
  
      Args:
          y_obs: An array of observations for a single metric.
          y_pred: An array of the predicted values corresponding to y_obs.
          se_pred: Not used, kept for API compatibility.
          eps: A small constant to add to the denominator for numerical stability.
  
      Returns:
          The scalar coefficient of determination, "R squared".
      """
      ss_res = ((y_obs - y_pred) ** 2).sum()
      ss_tot = ((y_obs - y_obs.mean()) ** 2).sum()
      return 1 - (ss_res / (ss_tot + eps))
  
file_path: Ax/ax/utils/stats/model_fit_stats.py
imports: from typing import Dict, Mapping, Optional, Protocol
  import numpy
  from scipy.stats import fisher_exact, norm, pearsonr, spearmanr
label_desc: Use image node_id 2 for calling a global function with example usage: coefficient_of_determination(y_obs, y_pred, se_pred, eps) and returns: unknown