Friday, June 23, 2017

Sigmoid function

sigmoid function

Sigmoid function is frequently used in machine learning, because it can approximates discontinuous function like step function.
This function is very simple as you can see.

In the code, you can write like this.
import numpy as np

def sig(x):
    return 1 / (1 + np.exp(-x))
And by plotting.
import matplotlib.pyplot as plt

x = list(range(-100, 100))
y = [sig(i) for i in x]
plt.plot(x, y)
plt.show()



On this plot, the inclination looks too strong.
By focusing on small range, we check this.
x = list(range(-10, 10))
y = [sig(i) for i in x]
plt.plot(x, y)
plt.show()


By this, we can see how it changes.
Sigmoid function has following characteristics.
  • When the input is equal to 0, the output is 1/2.
  • This function is monotonically increasing.
  • This function is point symmetry at (0, 1/2)