mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-10 19:57:17 +03:00
Auto-format
This commit is contained in:
parent
bd435faddd
commit
1f648ecb76
|
@ -353,6 +353,7 @@ class Scorer(object):
|
|||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
# DAMAGE.
|
||||
|
||||
|
||||
def _roc_auc_score(y_true, y_score):
|
||||
"""Compute Area Under the Receiver Operating Characteristic Curve (ROC AUC)
|
||||
from prediction scores.
|
||||
|
@ -490,19 +491,19 @@ def _binary_clf_curve(y_true, y_score):
|
|||
thresholds : array, shape = [n_thresholds]
|
||||
Decreasing score values.
|
||||
"""
|
||||
pos_label = 1.
|
||||
pos_label = 1.0
|
||||
|
||||
y_true = np.ravel(y_true)
|
||||
y_score = np.ravel(y_score)
|
||||
|
||||
# make y_true a boolean vector
|
||||
y_true = (y_true == pos_label)
|
||||
y_true = y_true == pos_label
|
||||
|
||||
# sort scores and corresponding truth values
|
||||
desc_score_indices = np.argsort(y_score, kind="mergesort")[::-1]
|
||||
y_score = y_score[desc_score_indices]
|
||||
y_true = y_true[desc_score_indices]
|
||||
weight = 1.
|
||||
weight = 1.0
|
||||
|
||||
# y_score typically has many tied values. Here we extract
|
||||
# the indices associated with the distinct values. We also
|
||||
|
@ -533,8 +534,11 @@ def _stable_cumsum(arr, axis=None, rtol=1e-05, atol=1e-08):
|
|||
"""
|
||||
out = np.cumsum(arr, axis=axis, dtype=np.float64)
|
||||
expected = np.sum(arr, axis=axis, dtype=np.float64)
|
||||
if not np.all(np.isclose(out.take(-1, axis=axis), expected, rtol=rtol,
|
||||
atol=atol, equal_nan=True)):
|
||||
if not np.all(
|
||||
np.isclose(
|
||||
out.take(-1, axis=axis), expected, rtol=rtol, atol=atol, equal_nan=True
|
||||
)
|
||||
):
|
||||
raise ValueError(Errors.E163)
|
||||
return out
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user