Created
January 5, 2017 07:13
-
-
Save peroon/490cd9cfa28546659ffb0f9be2dd5cca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import os, sys, unittest | |
| import math | |
| class Sample(): | |
| def sigmoid(self, v): | |
| return 1.0 / (1 + math.e**(-v)) | |
| class SampleTest(unittest.TestCase): | |
| def setUp(self): | |
| self.smpl = Sample() | |
| def test_sigmoid(self): | |
| expected = 0.7310585786300049 | |
| actual = self.smpl.sigmoid(1) | |
| self.assertEqual(expected, actual) | |
| if __name__ == '__main__': | |
| unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment