Package mvpa :: Package tests :: Module test_plr
[hide private]
[frames] | no frames]

Source Code for Module mvpa.tests.test_plr

 1  # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- 
 2  # vi: set ft=python sts=4 ts=4 sw=4 et: 
 3  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## 
 4  # 
 5  #   See COPYING file distributed along with the PyMVPA package for the 
 6  #   copyright and license terms. 
 7  # 
 8  ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## 
 9  """Unit tests for PyMVPA logistic regression classifier""" 
10   
11  from mvpa.clfs.plr import PLR 
12  from tests_warehouse import * 
13   
14   
15 -class PLRTests(unittest.TestCase):
16
17 - def testPLR(self):
18 data = datasets['dumb2'] 19 20 clf = PLR() 21 22 clf.train(data) 23 24 # prediction has to be perfect 25 self.failUnless((clf.predict(data.samples) == data.labels).all())
26
27 - def testPLRState(self):
28 data = datasets['dumb2'] 29 30 clf = PLR() 31 32 clf.train(data) 33 34 clf.states.enable('values') 35 clf.states.enable('predictions') 36 37 p = clf.predict(data.samples) 38 39 self.failUnless((p == clf.predictions).all()) 40 self.failUnless(N.array(clf.values).shape == N.array(p).shape)
41 42
43 -def suite():
44 return unittest.makeSuite(PLRTests)
45 46 47 if __name__ == '__main__': 48 import runner 49