Activation for Output Layers-2

Sigmoid Output Activation Function
The sigmoid of logistic activation function was described in the previous section.

Nevertheless, to add some symmetry, we can review for the shape of this function with the worked example below.

example plot for the sigmoid activation function

from math import exp
from matplotlib import pyplot

sigmoid activation function

def sigmoid(x):
return 1.0 / (1.0 + exp(-x))

define input data

inputs = [x for x in range(-10, 10)]

calculate outputs

outputs = [sigmoid(x) for x in inputs]

plot inputs vs outputs

pyplot.plot(inputs, outputs)
pyplot.show()
Running the example calculates the outputs for a range of values and creates a plot of inputs versus outputs.

We can see the familiar S-shape of the sigmoid activation function.

Plot of Inputs vs. Outputs for the Sigmoid Activation Function.
Plot of Inputs vs. Outputs for the Sigmoid Activation Function.

Target labels used to train a model with a sigmoid activation function in the output layer will have the values 0 or 1.