更新时间:2022-03-21 18:41:30
当采用数组或其他不想使用Python数学库的指数时,请改用NumPy库:
When you are taking the exponent of an array or anything else you don't want to use Python's math library, use NumPy library instead:
import numpy as np
def sigmoid(inX):
r = 1.0/(1+ np.exp(-inX))
return r