#NEWLINE# def roc_auc_score( y_true , y_score , average = 'macro' , sample_weight = None ) : #NEWLINE# #INDENT# 'Compute Area Under the Curve (AUC) from prediction scores\n\n    Note: this implementation is restricted to the binary classification task\n    or multilabel classification task in label indicator format.\n\n    Read more in the :ref:`User Guide <roc_metrics>`.\n\n    Parameters\n    ----------\n    y_true : array, shape = [n_samples] or [n_samples, n_classes]\n        True binary labels in binary label indicators.\n\n    y_score : array, shape = [n_samples] or [n_samples, n_classes]\n        Target scores, can either be probability estimates of the positive\n        class, confidence values, or non-thresholded measure of decisions\n        (as returned by "decision_function" on some classifiers).\n\n    average : string, [None, \'micro\', \'macro\' (default), \'samples\', \'weighted\']\n        If ``None``, the scores for each class are returned. Otherwise,\n        this determines the type of averaging performed on the data:\n\n        ``\'micro\'``:\n            Calculate metrics globally by considering each element of the label\n            indicator matrix as a label.\n        ``\'macro\'``:\n            Calculate metrics for each label, and find their unweighted\n            mean.  This does not take label imbalance into account.\n        ``\'weighted\'``:\n            Calculate metrics for each label, and find their average, weighted\n            by support (the number of true instances for each label).\n        ``\'samples\'``:\n            Calculate metrics for each instance, and find their average.\n\n    sample_weight : array-like of shape = [n_samples], optional\n        Sample weights.\n\n    Returns\n    -------\n    auc : float\n\n    References\n    ----------\n    .. [1] `Wikipedia entry for the Receiver operating characteristic\n            <https://en.wikipedia.org/wiki/Receiver_operating_characteristic>`_\n\n    See also\n    --------\n    average_precision_score : Area under the precision-recall curve\n\n    roc_curve : Compute Receiver operating characteristic (ROC)\n\n    Examples\n    --------\n    >>> import numpy as np\n    >>> from sklearn.metrics import roc_auc_score\n    >>> y_true = np.array([0, 0, 1, 1])\n    >>> y_scores = np.array([0.1, 0.4, 0.35, 0.8])\n    >>> roc_auc_score(y_true, y_scores)\n    0.75\n\n    ' #NEWLINE# def _binary_roc_auc_score( y_true , y_score , sample_weight = None ) : #NEWLINE# #INDENT# if ( len ( np . unique ( y_true ) ) != 2 ) : #NEWLINE# #INDENT# raise ValueError ( 'Only one class present in y_true. ROC AUC score is not defined in that case.' ) #NEWLINE# #UNINDENT# ( fpr , tpr , tresholds ) = roc_curve ( y_true , y_score , sample_weight = sample_weight ) #NEWLINE# return auc ( fpr , tpr , reorder = True ) #NEWLINE# #UNINDENT# return _average_binary_score ( _binary_roc_auc_score , y_true , y_score , average , sample_weight = sample_weight )