bigframes.ml.metrics.accuracy_score#
- bigframes.ml.metrics.accuracy_score(y_true: DataFrame | Series, y_pred: DataFrame | Series, *, normalize=True) float[source]#
Accuracy classification score.
Examples:
>>> import bigframes.pandas as bpd >>> import bigframes.ml.metrics
>>> y_true = bpd.DataFrame([0, 2, 1, 3]) >>> y_pred = bpd.DataFrame([0, 1, 2, 3]) >>> accuracy_score = bigframes.ml.metrics.accuracy_score(y_true, y_pred) >>> accuracy_score np.float64(0.5)
If False, return the number of correctly classified samples:
>>> accuracy_score = bigframes.ml.metrics.accuracy_score(y_true, y_pred, normalize=False) >>> accuracy_score np.int64(2)
- Parameters:
y_true (Series or DataFrame of shape (n_samples,)) – Ground truth (correct) labels.
y_pred (Series or DataFrame of shape (n_samples,)) – Predicted labels, as returned by a classifier.
normalize (bool, default True) – Default to True. If
False, return the number of correctly classified samples. Otherwise, return the fraction of correctly classified samples.
- Returns:
- If
normalize == True, return the fraction of correctly classified samples (float), else returns the number of correctly classified samples (int).
- If
- Return type: