본문 바로가기
Python

Python Code: Sigmoid Funtion

by YJHTPII 2022. 5. 16.
반응형

 import math

 

def sigmoid(x, diff=False):

    if diff:

        return sigmoid(x)*(1-sigmoid(x))

    else:

        return 1/(1+math.exp(-x))

 

반응형

댓글