annotate tests/test_sigmoid.py @ 21:0149be5a984c

[iterable] add function to tell True/False if argument is an iterable
author Jeff Hammel <k0scist@gmail.com>
date Mon, 04 Sep 2017 08:37:06 -0700
parents d6d2ecb33c95
children 38aa9098bf2d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3 """
20
d6d2ecb33c95 [logistic regression] smoke tests
Jeff Hammel <k0scist@gmail.com>
parents: 19
diff changeset
4 test sigmoid related functionality
18
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5 """
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7 import os
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8 import unittest
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9 from tvii.sigmoid import sigmoid
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12 class TestSigmoid(unittest.TestCase):
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14 def test_basic(self):
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15 """test two points of the sigmoid function"""
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
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
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
21
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
22 if __name__ == '__main__':
e92fc4a17336 add failing test
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
23 unittest.main()