code: def explained_variance(ypred, y):
      """
      Computes fraction of variance that ypred explains about y.
      Returns 1 - Var[y-ypred] / Var[y]
  
      interpretation:
          ev=0  =>  might as well have predicted zero
          ev=1  =>  perfect prediction
          ev<0  =>  worse than just predicting zero
  
      """
      assert y.ndim == 1 and ypred.ndim == 1
      vary = np.var(y)
      return np.nan if vary == 0 else 1 - np.var(y - ypred) / vary
  
file_path: nni/nni/algorithms/hpo/ppo_tuner/util.py
imports: import os
  import random
  import multiprocessing
  import numpy
  import tensorflow.compat.v1
  from gym.spaces import Discrete, Box, MultiDiscrete
label_desc: Use image node_id 14 for calling a global function with example usage: explained_variance(ypred, y) and returns: unknown