Home > Blockchain >  Sigmoid function returning 2
Sigmoid function returning 2

Time:01-15

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 ?

CodePudding user response:

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))
  • Related