(y_true, y_pred, sample_weight=None)
return n_differents.sum() / n_samples
Compute the one_error,similar to 0/1-loss.
    Parameters
    ----------
    y_true : array, shape = [n_samples] or [n_samples, n_classes]
        True binary labels or binary label indicators.

    y_score : array, shape = [n_samples] or [n_samples, n_classes]
        Target scores, can either be probability estimates of the positive
        class, confidence values, or non-thresholded measure of decisions
        (as returned by "decision_function" on some classifiers).

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

    Returns
    -------
    one_error : float
Compute the one_error,similar to 0/1-loss.
    Parameters
    ----------
    y_true : array, shape = [n_samples] or [n_samples, n_classes]
        True binary labels or binary label indicators.
Compute the one_error similar to 0 / 1 - loss . Parameters ---------- y_true : array shape = [ n_samples ] or [ n_samples n_classes ] True binary labels or binary label indicators .
def one_error(y_true, y_pred, sample_weight=None):
    '''
        Compute the one_error,similar to 0/1-loss.
    Parameters
    ----------
    y_true : array, shape = [n_samples] or [n_samples, n_classes]
        True binary labels or binary label indicators.

    y_score : array, shape = [n_samples] or [n_samples, n_classes]
        Target scores, can either be probability estimates of the positive
        class, confidence values, or non-thresholded measure of decisions
        (as returned by "decision_function" on some classifiers).

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

    Returns
    -------
    one_error : float
    '''
    check_consistent_length(y_true, y_pred, sample_weight)
    y_type = type_of_target(y_true)
    n_samples, n_labels = y_true.shape
    if y_type != "multilabel":
        raise ValueError("{0} format is not supported".format(y_type))
    n_differents = np.sum((y_true - y_pred), axis=1) == 0

    return n_differents.sum() / n_samples
def one_error ( y_true , y_pred , sample_weight = None ) : check_consistent_length ( y_true , y_pred , sample_weight ) y_type = type_of_target ( y_true ) n_samples , n_labels = y_true . shape if y_type != "multilabel" : raise ValueError ( "{0} format is not supported" . format ( y_type ) ) n_differents = np . sum ( ( y_true - y_pred ) , axis = 1 ) == 0 return n_differents . sum ( ) / n_samples