Skip to content

Commit 1ac91af

Browse files
author
Fabian Pedregosa
committed
Doc: better tests for logistic.
Reverse order of classes after sugestion Methieu Blondel, this way we also check that predict_proba does the right sorting for each class. Also removed obsolete tests.
1 parent b6f14db commit 1ac91af

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

scikits/learn/glm/sparse/tests/test_logistic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
X = [[-1, 0], [0, 1], [1, 1]]
1212
Y1 = [0, 1, 1]
13-
Y2 = [0, 1, 2]
13+
Y2 = [2, 1, 0]
1414
iris = datasets.load_iris()
1515

1616
def test_predict_2_classes():

scikits/learn/glm/tests/test_logistic.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
X = [[-1, 0], [0, 1], [1, 1]]
1212
Y1 = [0, 1, 1]
13-
Y2 = [0, 1, 2]
13+
Y2 = [2, 1, 0]
1414
iris = datasets.load_iris()
1515

1616
def test_predict_2_classes():
@@ -54,19 +54,6 @@ def test_predict_iris():
5454
pred = clf.predict_proba(iris.data).argmax(axis=1)
5555
assert np.mean(pred == iris.target) > .95
5656

57-
def test_predict_proba():
58-
"""
59-
I think this test is wrong. Is there a way to know the right results ?
60-
"""
61-
raise nose.SkipTest("XFailed test")
62-
clf = logistic.LogisticRegression().fit(X, Y2)
63-
assert_array_almost_equal(clf.predict_proba([[1, 1]]),
64-
[[ 0.21490268, 0.32639437, 0.45870294]])
65-
66-
clf = logistic.LogisticRegression(penalty='l1').fit(X, Y2)
67-
assert_array_almost_equal(clf.predict_proba([[2, 2]]),
68-
[[ 0.33333333, 0.33333333, 0.33333333]])
69-
7057

7158
if __name__ == '__main__':
7259
import nose

0 commit comments

Comments
 (0)