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

Read more of this post