Skip to content

Commit d6e722a

Browse files
committed
One less warning in QDA tests.
1 parent be2894a commit d6e722a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

sklearn/tests/test_qda.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from sklearn.utils.testing import assert_array_equal
44
from sklearn.utils.testing import assert_array_almost_equal
55
from sklearn.utils.testing import assert_true
6+
from sklearn.utils.testing import assert_greater
67

78
from sklearn import qda
89

@@ -48,9 +49,16 @@ def test_qda():
4849

4950

5051
def test_qda_priors():
51-
clf = qda.QDA(priors=np.array([0.0, 1.0]))
52+
clf = qda.QDA()
53+
y_pred = clf.fit(X, y).predict(X)
54+
n_pos = np.sum(y_pred == 2)
55+
56+
neg = 1e-10
57+
clf = qda.QDA(priors=np.array([neg, 1 - neg]))
5258
y_pred = clf.fit(X, y).predict(X)
53-
assert (y_pred == 2).all()
59+
n_pos2 = np.sum(y_pred == 2)
60+
61+
assert_greater(n_pos2, n_pos)
5462

5563

5664
def test_qda_store_covariances():

0 commit comments

Comments
 (0)