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.
- Args:
df: Input dataframe. y_true_col_names: Column name(s) representing actual values. y_pred_col_names: Column name(s) representing predicted values. normalize: If
False
, return the number of correctly classified samples.Otherwise, return the fraction of correctly classified samples.
sample_weight_col_name: 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 withnormalize == False
.