comparison _test_linear_regression.py @ 524:317a052f9b14

better main, allow to debug in a debugger.
author Frederic Bastien <bastienf@iro.umontreal.ca>
date Fri, 14 Nov 2008 16:46:03 -0500
parents 8e4d2ebd816a
children
comparison
equal deleted inserted replaced
523:111e547ffa7b 524:317a052f9b14
19 test_data = testset.fields() 19 test_data = testset.fields()
20 mse = predictor.compute_mse(test_data['input'],test_data['target']) 20 mse = predictor.compute_mse(test_data['input'],test_data['target'])
21 print 'mse = ',mse 21 print 'mse = ',mse
22 22
23 if __name__ == '__main__': 23 if __name__ == '__main__':
24 unittest.main() 24 import sys
25 25
26 if len(sys.argv)==1:
27 unittest.main()
28 else:
29 assert sys.argv[1]=="--debug"
30 tests = []
31 for arg in sys.argv[2:]:
32 tests.append(arg)
33 if tests:
34 unittest.TestSuite(map(T_DataSet, tests)).debug()
35 else:
36 module = __import__("_test_linear_regression")
37 tests = unittest.TestLoader().loadTestsFromModule(module)
38 tests.debug()