0

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 that the function is returning 2.0, but sigmoid is only supposed to return numbers between 0 and 1 Am I missing something obvious ?

Ahmed Sbai
  • 10,695
  • 9
  • 19
  • 38
Lalaryk
  • 23
  • 1

1 Answers1

1

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))
Domenico
  • 126
  • 13