You are viewing documentation about an older version (1.7.0). View latest version

snowflake.ml.modeling.metrics.r2_score¶

snowflake.ml.modeling.metrics.r2_score(*, df: DataFrame, y_true_col_name: str, y_pred_col_name: str) → float¶

R^2 (coefficient of determination) regression score function. Returns R squared metric on 2 columns in the dataframe.

Best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). In the general case when the true y is non-constant, a constant model that always predicts the average y disregarding the input features would get a R^2 score of 0.0.

Parameters:
  • df – snowpark.DataFrame Input dataframe.

  • y_true_col_name – string Column name representing actual values.

  • y_pred_col_name – string Column name representing predicted values.

Returns:

R squared metric.