Mercurial > hg > tvii
comparison tests/test_logistic_regression.py @ 22:3713c6733990
[logistic regression] introduce illustrative test
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 04 Sep 2017 08:59:52 -0700 |
parents | b6a146f0a61b |
children | f34110e28a0a |
comparison
equal
deleted
inserted
replaced
21:0149be5a984c | 22:3713c6733990 |
---|---|
2 | 2 |
3 """ | 3 """ |
4 test logistic regression | 4 test logistic regression |
5 """ | 5 """ |
6 | 6 |
7 import numpy as np | |
7 import os | 8 import os |
8 import unittest | 9 import unittest |
9 from tvii import logistic_regression | 10 from tvii import logistic_regression |
10 | 11 |
11 class LogisticRegresionTests(unittest.TestCase): | 12 class LogisticRegresionTests(unittest.TestCase): |
12 def test_basic(self): | 13 |
13 """placeholder""" | 14 def test_cost(self): |
15 """test cost function""" | |
16 | |
17 w, b, X, Y = (np.array([[1],[2]]), | |
18 2, | |
19 np.array([[1,2],[3,4]]), | |
20 np.array([[1,0]])) | |
21 | |
22 expected_cost = 6.000064773192205 | |
23 cost = logistic_regression.cost_function(w, b, X, Y) | |
24 print cost | |
14 | 25 |
15 if __name__ == '__main__': | 26 if __name__ == '__main__': |
16 unittest.main() | 27 unittest.main() |