# HG changeset patch # User Jeff Hammel # Date 1504496786 25200 # Node ID cd43ce453358c0b3ee633663807ada484d0195fa # Parent e92fc4a17336c1333dd3a75575c172ef38990328 [numpy] of course we have to cast everything here too diff -r e92fc4a17336 -r cd43ce453358 tests/test_sigmoid.py --- a/tests/test_sigmoid.py Sun Sep 03 19:40:29 2017 -0700 +++ b/tests/test_sigmoid.py Sun Sep 03 20:46:26 2017 -0700 @@ -15,8 +15,7 @@ """test two points of the sigmoid function""" answer = sigmoid([0,2]) - assert len(answer(2)) - + assert len(answer) == 2 if __name__ == '__main__': unittest.main() diff -r e92fc4a17336 -r cd43ce453358 tvii/sigmoid.py --- a/tvii/sigmoid.py Sun Sep 03 19:40:29 2017 -0700 +++ b/tvii/sigmoid.py Sun Sep 03 20:46:26 2017 -0700 @@ -3,8 +3,10 @@ """ import numpy as np - +from .iterable import isiterable def sigmoid(z): """https://en.wikipedia.org/wiki/Sigmoid_function""" + if not isinstance(z, np.ndarray) and isiterable(z): + z = np.array(z) return 1./(1. + np.exp(-z))