Mercurial > hg > tvii
comparison tests/test_logistic_regression.py @ 23:f34110e28a0a
[logistic regression] we have a working cost function
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 04 Sep 2017 09:14:25 -0700 |
parents | 3713c6733990 |
children | 77f68c241b37 |
comparison
equal
deleted
inserted
replaced
22:3713c6733990 | 23:f34110e28a0a |
---|---|
19 np.array([[1,2],[3,4]]), | 19 np.array([[1,2],[3,4]]), |
20 np.array([[1,0]])) | 20 np.array([[1,0]])) |
21 | 21 |
22 expected_cost = 6.000064773192205 | 22 expected_cost = 6.000064773192205 |
23 cost = logistic_regression.cost_function(w, b, X, Y) | 23 cost = logistic_regression.cost_function(w, b, X, Y) |
24 print cost | 24 assert abs(cost - expected_cost) < 1e-6 |
25 | 25 |
26 if __name__ == '__main__': | 26 if __name__ == '__main__': |
27 unittest.main() | 27 unittest.main() |