简体   繁体   中英

user-defined Sigmoid function in python

I have one doubt on using user-defined sigmoid function(Logistic). I tried using numpy.exp & math.exp for the sigmoid formula (1 / 1+ e^-x) .

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

Both methods gives the value 6.900207837141513e-36 for x = -80.96151181531121. But, we are expecting a value between 0 & 1. Am I missing anything?

6.900207837141513e-36 is scientific record for 0.00...06900207837141513 (I omitted 13 zeroes)

You can read it as "6.900... divided by 10^36". In this case you probably can treat value as 0.

See https://en.wikipedia.org/wiki/Scientific_notation#E_notation

>>> 6.900207837141513e-36 > 0
True

Note the e-36 on the end of 6.900207837141513e-36 . This is equivalent to the scientific notation 6.900207837141513 * 10^-36 . In other words, it is a very small value that is basically zero.

6.900207837141513e-36 is a scientific notation for "6.9002... divided by 10^36"

In your case, you probably should treat it as 0.

See https://en.wikipedia.org/wiki/Scientific_notation#E_notation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM