Derivative of sigmoid function
Let's write the derivative of sigmoid function in Perl. A derivative is a derivative of a function. The derivative of the sigmoid function is used for the inverse mispropagation method.
#Derivative of sigmoid function sub sigmoid_derivative { my ($x) = @_; my $sigmoid_derivative = sigmoid ($x) * (1 --sigmoid ($x)); return $sigmoid_derivative; } #Sigmoid function sub sigmoid { my ($x) = @_; my $sigmoid = 1.0 / (1.0 + exp(-$x)); return $sigmoid; } my $x = 0.5; my $sigmoid_derivative = sigmoid_derivative ($x); # 0.2350037122015944890693 print "$sigmoid_derivative\n";