code: def h2o_explained_variance_score(y_actual, y_predicted, weights=None):
      """
      Explained variance regression score function.
  
      :param y_actual: H2OFrame of actual response.
      :param y_predicted: H2OFrame of predicted response.
      :param weights: (Optional) sample weights.
      :returns: the explained variance score.
      """
      ModelBase._check_targets(y_actual, y_predicted)
  
      _, numerator = _mean_var(y_actual - y_predicted, weights)
      _, denominator = _mean_var(y_actual, weights)
      if denominator == 0.0:
          return (
              1.0 if numerator == 0 else 0.0
          )  # 0/0 => 1, otherwise, 0
      return 1 - numerator / denominator
  
file_path: h2o-3/h2o-py/h2o/model/models/regression.py
imports: from h2o.exceptions import H2OValueError
  from h2o.model import ModelBase
  from h2o.model.extensions import has_extension
  from h2o.utils.compatibility import *
  from h2o.utils.shared_utils import _colmean
  from h2o.utils.typechecks import assert_is_type
label_desc: Use image node_id 5 for calling a global function with example usage: h2o_explained_variance_score(y_actual, y_predicted, weights) and returns: unknown, unknown