将
def sigmoid(inX):
from numpy import exp
return 1.0/(1+exp(-inX))
改为
def sigmoid(inX):
from numpy import exp
#return 1.0/(1+exp(-inX))
#优化
if inX>=0:
return 1.0/(1+exp(-inX))
else:
return exp(inX)/(1+exp(inX))
原文:https://blog.csdn.net/cckchina/article/details/79915181