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

snowflake.ml.modeling.metrics.accuracy_score¶

snowflake.ml.modeling.metrics.accuracy_score(*, df: DataFrame, y_true_col_names: Union[str, List[str]], y_pred_col_names: Union[str, List[str]], normalize: bool = True, sample_weight_col_name: Optional[str] = None) → float¶

Accuracy classification score.

In multilabel classification, this function computes subset accuracy: the set of labels predicted for a sample must exactly match the corresponding set of labels in the y true columns.

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.

  • normalize – boolean, default=True If False, return the number of correctly classified samples. Otherwise, return the fraction of correctly classified samples.

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

Returns:

If normalize == True, return the fraction of correctly classified samples (float), else returns the number of correctly classified samples (int).

The best performance is 1 with normalize == True and the number of samples with normalize == False.