Sigmoid 激活函数实现(Sigmoid Activation Function Implementation)是神经网络中的最常见的激活函数之一。 Sigmoid函数其公式为

标准代码如下

def sigmoid(z: float) -> float:
   result = 1 / (1 + math.exp(-z))
   return round(result, 4)