I've got a 2d numpy array on which I want to use my function sigmoid(x) which is:
def sigmoid(x):
return 1 / (1 + np.exp(-x))
My problem is that I have inputs that are too big like 3000 and I get this warning:
RuntimeWarning: overflow encountered in exp
return 1 / (1 + np.exp(-x/8.))
I tried to just assign values to inputs over a certain number like 700 -> 1 and -700 -> 0, however, this is very slow because I obv have to loop over the whole array that way.
I have also looked into np.logandexp(x1, x2)
but I can't get it to work...
Edit: The datatype is float64 btw