Mercurial > hg > tvii
annotate tests/test_sigmoid.py @ 31:fa7a51df0d90
[logistic regression] test gradient descent
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 04 Sep 2017 12:37:45 -0700 |
parents | d6d2ecb33c95 |
children | 38aa9098bf2d |
rev | line source |
---|---|
18 | 1 #!/usr/bin/env python |
2 | |
3 """ | |
20
d6d2ecb33c95
[logistic regression] smoke tests
Jeff Hammel <k0scist@gmail.com>
parents:
19
diff
changeset
|
4 test sigmoid related functionality |
18 | 5 """ |
6 | |
7 import os | |
8 import unittest | |
9 from tvii.sigmoid import sigmoid | |
10 | |
11 | |
12 class TestSigmoid(unittest.TestCase): | |
13 | |
14 def test_basic(self): | |
15 """test two points of the sigmoid function""" | |
16 | |
17 answer = sigmoid([0,2]) | |
19
cd43ce453358
[numpy] of course we have to cast everything here too
Jeff Hammel <k0scist@gmail.com>
parents:
18
diff
changeset
|
18 assert len(answer) == 2 |
20
d6d2ecb33c95
[logistic regression] smoke tests
Jeff Hammel <k0scist@gmail.com>
parents:
19
diff
changeset
|
19 assert answer[0] == 0.5 |
d6d2ecb33c95
[logistic regression] smoke tests
Jeff Hammel <k0scist@gmail.com>
parents:
19
diff
changeset
|
20 assert abs(answer[1] - 0.88079708) < 1e-6 |
18 | 21 |
22 if __name__ == '__main__': | |
23 unittest.main() |