Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Sigmoid function returning 2

So i just started learning about neural networks and i’m using the sigmoid function.
Here’s the implementation : def sigmoid(x): return 1/1+(np.exp(-x))

then I have my network : def make_predictions2(previousPrice, currentPrice, weight1, weight2, weight3, bias): n11 = np.dot(previousPrice, weight1) + np.dot(currentPrice, weight2) + bias n21 = np.dot(n11, weight3) + bias n31 = sigmoid(n21) return n31[0]
the problem is, here the function is returning 2.0, even though sigmoid is only suppose to return numbers between 0 and 1
Am i missing something obvious ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

As you can see in here, that definition of the sigmoid function is wrong. Instead of

def sigmoid(x): 
  return 1/1+(np.exp(-x))

you should use the following definition:

def sigmoid(x): 
  return 1/(1+np.exp(-x))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading