tanh関数の導関数 - 活性化関数の導関数
tanh関数の導関数は、逆誤伝播法に利用します。
use strict;
use warnings;
use Math::Trig 'tanh';
sub tanh_derivative {
my ($x) = @_;
my $tanh_derivative = 1 - tanh($x) ** 2;
return $tanh_derivative;
}
my $value1 = 0.5;
my $tanh_derivative1 = tanh_derivative($value1);
# 0.786447732965927
print "$tanh_derivative1\n";
Perl AI深層学習入門