Skip to content

Commit c902399

Browse files
Martinmblondel
authored andcommitted
added test for transformed scatter matrix
1 parent 49cee4b commit c902399

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sklearn/tests/test_lda.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ def test_lda_orthogonality():
7575
d1 /= np.sqrt(np.sum(d1**2))
7676
d2 /= np.sqrt(np.sum(d2**2))
7777

78+
# the transformed within-class covariance should be the identity matrix
79+
assert_almost_equal(np.cov(clf.transform(scatter).T), np.eye(2))
80+
7881
# the means of classes 0 and 3 should lie on the first component
7982
assert_almost_equal(np.abs(np.dot(d1[:2], [1, 0])), 1.0)
8083

0 commit comments

Comments
 (0)