Mercurial > hg > tvii
view tests/test_sigmoid.py @ 61:0e6743d5416d
notes on averaging
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 10 Dec 2017 18:18:32 -0800 |
parents | 38aa9098bf2d |
children |
line wrap: on
line source
#!/usr/bin/env python """ test sigmoid related functionality """ import os import unittest from tvii.sigmoid import sigmoid, sigmoidprime class TestSigmoid(unittest.TestCase): def test_basic(self): """test two points of the sigmoid function""" answer = sigmoid([0,2]) assert len(answer) == 2 assert answer[0] == 0.5 assert abs(answer[1] - 0.88079708) < 1e-6 def test_derivative(self): self.assertAlmostEqual(sigmoidprime(0), 0.25) if __name__ == '__main__': unittest.main()