class_docstr: Squared loss for distributional predictions.
  
  Also known as:
  
  * continuous Brier loss
  * Gneiting loss
  * (mean) squared error/loss, i.e., confusingly named the same as the
    point prediction loss commonly known as the mean squared error
  
  For a predictive distribution :math:`d`
  and a ground truth value :math:`y`, the squared (distribution) loss is
  defined as :math:`L(y, d) := -2 p_d(y) + \|p_d\|^2`,
  where :math:`\|p_d\|^2` is the (function) L2-norm of :math:`p_d`.
  
  `evaluate` computes the average test sample loss.
  `evaluate_by_index` produces the loss sample by test data point
  `multivariate` controls averaging over variables.
  
  Parameters
  ----------
  multioutput : {'raw_values', 'uniform_average'} or array-like of shape \
          (n_outputs,), default='uniform_average'
      Defines whether and how to aggregate metric for across variables.
      If 'uniform_average' (default), errors are mean-averaged across variables.
      If array-like, errors are weighted averaged across variables, values as weights.
      If 'raw_values', does not average errors across variables, columns are retained.
  multivariate : bool, optional, default=False
      if True, behaves as multivariate squared loss
      squared loss is computed for entire row, results one score per row
      if False, is univariate squared loss
      squared loss is computed per variable marginal, results in many scores per row
class_docstr_tok: ["Squared","loss","for","distributional","predictions",".","Also","known","as",":","*","continuous","Brier","loss","*","Gneiting","loss","*","(","mean",")","squared","error\/loss",",","i.e.",",","confusingly","named","the","same","as","the","point","prediction","loss","commonly","known","as","the","mean","squared","error","For","a","predictive","distribution",":","math",":","`","d","`","and","a","ground","truth","value",":","math",":","`","y","`",",","the","squared","(","distribution",")","loss","is","defined","as",":","math",":","`","L","(","y",",","d",")",":","=","-2","p_d","(","y",")","+","\\|p_d\\|^2","`",",","where",":","math",":","`","\\|p_d\\|^2","`","is","the","(","function",")","L2-norm","of",":","math",":","`","p_d","`",".","`","evaluate","`","computes","the","average","test","sample","loss",".","`","evaluate_by_index","`","produces","the","loss","sample","by","test","data","point","`","multivariate","`","controls","averaging","over","variables",".","Parameters","--","--","--","--","--","multioutput",":","{","'raw_values","'",",","'uniform_average","'","}","or","array-like","of","shape","\\","(","n_outputs",",",")",",","default='uniform_average'","Defines","whether","and","how","to","aggregate","metric","for","across","variables",".","If","'uniform_average","'","(","default",")",",","errors","are","mean-averaged","across","variables",".","If","array-like",",","errors","are","weighted","averaged","across","variables",",","values","as","weights",".","If","'raw_values","'",",","does","not","average","errors","across","variables",",","columns","are","retained",".","multivariate",":","bool",",","optional",",","default=False","if","True",",","behaves","as","multivariate","squared","loss","squared","loss","is","computed","for","entire","row",",","results","one","score","per","row","if","False",",","is","univariate","squared","loss","squared","loss","is","computed","per","variable","marginal",",","results","in","many","scores","per","row"]
code: def _evaluate_by_index(self, y_true, y_pred, multioutput, **kwargs):
      res = -2 * y_pred.log_pdf(y_true) + y_pred.pdfnorm(a=2)
      # replace this by multivariate log_pdf once distr implements
      # i.e., pass multivariate on to log_pdf
      if self.multivariate:
          return pd.DataFrame(res.mean(axis=1), columns=["density"])
      else:
          return res
  
imports: from logging import warning
  import numpy
  import pandas
  from pandas.api.types import is_numeric_dtype
  from sklearn.utils import check_array, check_consistent_length
  from sktime.datatypes import check_is_scitype, convert, convert_to
  from sktime.performance_metrics.forecasting._classes import BaseForecastingErrorMetric
  from sktime.performance_metrics.forecasting._coerce import _coerce_to_scalar
label_desc: Use image node_id 2 for calling the SquaredDistrLoss obj's underlying member method code with example usage: obj._evaluate_by_index(y_true, y_pred, multioutput) and returns: pd, res