(y_true, y_pred, sample_weight=None)
return np.average(score, weights=sample_weight)
Accuracy classification score.

    Parameters
    ----------
    y_true : 1d array-like, or label indicator array / sparse matrix
        Ground truth (correct) _labels.

    y_pred : 1d array-like, or label indicator array / sparse matrix
        Predicted _labels, as returned by a classifier.

    sample_weight : array-like of shape = [n_samples], optional
        Sample weights.

    Returns
    -------
    score : float
Accuracy classification score.
Accuracy classification score .
def accuracy_score(y_true, y_pred, sample_weight=None):
    """Accuracy classification score.

    Parameters
    ----------
    y_true : 1d array-like, or label indicator array / sparse matrix
        Ground truth (correct) _labels.

    y_pred : 1d array-like, or label indicator array / sparse matrix
        Predicted _labels, as returned by a classifier.

    sample_weight : array-like of shape = [n_samples], optional
        Sample weights.

    Returns
    -------
    score : float
    """
    y_type, y_true, y_pred = _check_targets(y_true, y_pred)
    check_consistent_length(y_true, y_pred, sample_weight)

    if y_type.startswith('multilabel'):
    
        differing_labels = np.diff((y_true - y_pred).indptr)
        score = differing_labels == 0
    else:
        score = y_true == y_pred
    return np.average(score, weights=sample_weight)
def accuracy_score ( y_true , y_pred , sample_weight = None ) : y_type , y_true , y_pred = _check_targets ( y_true , y_pred ) check_consistent_length ( y_true , y_pred , sample_weight ) if y_type . startswith ( 'multilabel' ) : differing_labels = np . diff ( ( y_true - y_pred ) . indptr ) score = differing_labels == 0 else : score = y_true == y_pred return np . average ( score , weights = sample_weight )