SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
28.
Perceptron [’58 Rosenblatt]
— 原理
学習手続
1. 重みベクトルを w = (0, . . ., 0) で初期化
2. 現在の重みでの判定結果 g
3. 本来の正しい判定結果 a ∈ {1, −1}
4. a · g > 0 なら判定成功 or フィードバック
判定: 重み w と入力 p の内積 (の正負)
◮ w · p
フィードバック
◮ 正しい結果の向きに入力分だけ重みを更新
w := w + ap
29.
Perceptronの簡単な実装
sub weights { shift->{weights} ||= {} }
sub feedback {
my ($self, $ps, $ad) = @_;
$self->weights->{$_} += $ad * $ps->{$_} for keys %$ps;
}
sub learn {
my ($self, $ps, $ad) = @_;
my $g = $self->guess($ps) || 0;
$self->feedback($ps, $ad) unless $g * $ad > 0;
}
sub guess {
my ($self, $ps) = @_;
my $weights = $self->weights || {};
return sum map {
($weights->{$_} || 0) * $ps->{$_};
} keys %$ps;
}