snowflake.ml.modeling.metrics.d2_pinball_score¶

snowflake.ml.modeling.metrics.d2_pinball_score(*, df: DataFrame, y_true_col_names: Union[str, List[str]], y_pred_col_names: Union[str, List[str]], sample_weight_col_name: Optional[str] = None, alpha: float = 0.5, multioutput: Union[str, _SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]] = 'uniform_average') → Union[float, ndarray[Any, dtype[float64]]]¶

D^2 regression score function, fraction of pinball loss explained.

Best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A model that always uses the empirical alpha-quantile of y_true as constant prediction, disregarding the input features, gets a D^2 score of 0.0.

Parameters:
  • df – snowpark.DataFrame Input dataframe.

  • y_true_col_names – string or list of strings Column name(s) representing actual values.

  • y_pred_col_names – string or list of strings Column name(s) representing predicted values.

  • sample_weight_col_name – string, default=None Column name representing sample weights.

  • alpha – float, default=0.5 Slope of the pinball deviance. It determines the quantile level alpha for which the pinball deviance and also D2 are optimal. The default alpha=0.5 is equivalent to d2_absolute_error_score.

  • multioutput –

    {‘raw_values’, ‘uniform_average’} or array-like of shape (n_outputs,), default=’uniform_average’ Defines aggregating of multiple output values. Array-like value defines weights used to average errors. ‘raw_values’:

    Returns a full set of errors in case of multioutput input.

    ’uniform_average’:

    Scores of all outputs are averaged with uniform weight.

Returns:

float or ndarray of floats

The D^2 score with a pinball deviance or ndarray of scores if multioutput=’raw_values’.

Return type:

score