8000 CLN Updates to roc_auc · thomasjpfan/scikit-learn@f7f2e2e · GitHub
[go: up one dir, main page]

Skip to content

Commit f7f2e2e

Browse files
committed
CLN Updates to roc_auc
1 parent 71b19a3 commit f7f2e2e

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

doc/developers/contributing.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,11 +1675,11 @@ attributes:
16751675
.. code-block:: python
16761676
16771677
class RocCurveVisualizer:
1678-
def __init__(self, fpr, tpr, auc_roc, estimator_name):
1678+
def __init__(self, fpr, tpr, roc_auc, estimator_name):
16791679
...
16801680
self.fpr = ...
16811681
self.tpr = ...
1682-
self.auc_roc = ...
1682+
self.roc_auc = ...
16831683
self.estimator_name = estimator_name
16841684
16851685
def plot(self, ax=None, name=None, **kwargs):
@@ -1692,7 +1692,7 @@ attributes:
16921692
drop_intermediate=True, response_method="auto",
16931693
name=None, ax=None, **kwargs):
16941694
# do computation
1695-
viz = RocCurveVisualizer(fpr, tpr, auc_roc,
1695+
viz = RocCurveVisualizer(fpr, tpr, roc_auc,
16961696
estimator.__class__.__name__)
16971697
return viz.plot(ax=ax, name=name, **kwargs)
16981698
```

examples/model_selection/plot_roc_crossval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
interp_tpr = interp(mean_fpr, viz.fpr, viz.tpr)
7676
interp_tpr[0] = 0.0
7777
tprs.append(interp_tpr)
78-
aucs.append(viz.auc_roc)
78+
aucs.append(viz.roc_auc)
7979

8080
ax.plot([0, 1], [0, 1], linestyle='--', lw=2, color='r',
8181
label='Chance', alpha=.8)

sklearn/metrics/_plot/roc_curve.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class RocCurveVisualizer:
1818
False positive rate.
1919
tpr : ndarray
2020
True positive rate.
21-
auc_roc : float
21+
roc_auc : float
2222
Area under ROC curve.
2323
estimator_name : str
2424
Name of estimator.
@@ -33,10 +33,10 @@ class RocCurveVisualizer:
3333
Figure containing the curve
3434
"""
3535

36-
def __init__(self, fpr, tpr, auc_roc, estimator_name):
36+
def __init__(self, fpr, tpr, roc_auc, estimator_name):
3737
self.fpr = fpr
3838
self.tpr = tpr
39-
self.auc_roc = auc_roc
39+
self.roc_auc = roc_auc
4040
self.estimator_name = estimator_name
4141

4242
def plot(self, ax=None, name=None, **kwargs):
@@ -62,7 +62,7 @@ def plot(self, ax=None, name=None, **kwargs):
6262
name = self.estimator_name if name is None else name
6363

6464
if 'label' not in kwargs:
65-
label = "{} (AUC = {:0.2f})".format(name, self.auc_roc)
65+
label = "{} (AUC = {:0.2f})".format(name, self.roc_auc)
6666
kwargs['label'] = label
6767
self.line_ = ax.plot(self.fpr, self.tpr, **kwargs)[0]
6868
ax.set_xlabel("False Positive Rate")
@@ -146,6 +146,6 @@ def plot_roc_curve(estimator, X, y, pos_label=None, sample_weight=None,
146146
y_pred = y_pred[:, 1]
147147
fpr, tpr, _ = roc_curve(y, y_pred, pos_label=pos_label,
148148
drop_intermediate=drop_intermediate)
149-
auc_roc = auc(fpr, tpr)
150-
viz = RocCurveVisualizer(fpr, tpr, auc_roc, estimator.__class__.__name__)
149+
roc_auc = auc(fpr, tpr)
150+
viz = RocCurveVisualizer(fpr, tpr, roc_auc, estimator.__class__.__name__)
151151
return viz.plot(ax=ax, name=name, **kwargs)

sklearn/metrics/_plot/tests/test_plot_roc_curve.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_plot_roc_curve(pyplot, response_method, data_binary):
6363

6464
fpr, tpr, _ = roc_curve(y, y_pred)
6565

66-
assert_allclose(viz.auc_roc, auc(fpr, tpr))
66+
assert_allclose(viz.roc_auc, auc(fpr, tpr))
6767
assert_allclose(viz.fpr, fpr)
6868
assert_allclose(viz.tpr, tpr)
6969

@@ -76,5 +76,5 @@ def test_plot_roc_curve(pyplot, response_method, data_binary):
7676
assert isinstance(viz.ax_, mpl.axes.Axes)
7777
assert isinstance(viz.figure_, mpl.figure.Figure)
7878

79-
expected_label = "LogisticRegression (AUC = {:0.2f})".format(viz.auc_roc)
79+
expected_label = "LogisticRegression (AUC = {:0.2f})".format(viz.roc_auc)
8080
assert viz.line_.get_label() == expected_label

0 commit comments

Comments
 (0)
0