Professional Documents
Culture Documents
Adriano Cruz
13 de maro de 2013
Resumo Seo
1 Introduo
2 Treinamento
3 Treinamento - Teoria
4 Programando
Aproximando Funo
Iris
Clustering
5 Referncias
1 mensagem::adriano@nce.ufrj.br
2 pgina::http://equipe.nce.ufrj.br/adriano
3 sala::NCE - Sala E1033
4 tel::2598-3163
At agora?
MLPs
P1 1 1 1 Y1
P2 2 2 2 Y2
Pn0 n0 n1 nL Ynl
C0 C1 CL
net
Y
wn
xn
Correo
Resumo Seo
1 Introduo
2 Treinamento
3 Treinamento - Teoria
4 Programando
Aproximando Funo
Iris
Clustering
5 Referncias
Estratgias - Perodo
Estratgias - Perodo
Por bloco.
Combina os mtodos de ajuste por padro e ciclo.
Os pesos so ajustados aps a apresentao de k exemplos do conjunto
de treinamento.
Respostas
No existem frmulas para responder estas questes.
Sugestes
Dificuldades e Solues
Capacidade de Aprendizagem
Aumentar o nmero de elementos na camada escondida.
Aumentar o nmero de camadas escondidas.
Trocar/combinar diferentes funes de propagao.
Rever a representao dos dados.
Utilizar times de redes para resolver partes do problema e despois
combinar solues.
Perda de generalizao
Como evitar?
Pelo critrio de validao.
reduzir a arquitetura da rede.
adicionar rudo aos dados.
Quantidade disponvel
Pequena
Usar cross-validation
Gerar dados artificiais (caractersticas estatsticas semelhantes)
Boa
Separar conjuntos de treinamento/teste
Treinamento/teste/validao
Outliers
O que so
Pontos fora da curva
Qual sua influncia?
Podem at impedir o aprendizado.
Como tratar?
Eliminar (pode no ser possvel.)
Ajustar
Max-min
x min(x)
novox =
max(x) min(x)
Z-score
Reduo da dimensionalidade
1 Introduo
2 Treinamento
3 Treinamento - Teoria
4 Programando
Aproximando Funo
Iris
Clustering
5 Referncias
Parmetros da Rede
Avaliao do Erro:
n
1XL
2
E= hLi
2
i =1
E E
wlij = wlij =
wlij wlij
E E
wli 0 = wli 0 =
wli 0 wli 0
Considerando L = 2
Sabendo que: hLi = di yLi
E E h2i
=
w2ij h2i w2ij
E h2i y2i
=
h2i y2i w2ij
E h2i y2i net2i
=
h2i y2i net2i w2ij
Portanto:
E
= h2i (1) f2 (net2i ) x2j
w2ij
Continuando
Chamando
eli = hli fl (netli )
de erro ajustado do i-simo neurnio da l -sima camada,
temos
E
= e2i x2j
w2ij
Da mesma forma
E
= e2i
b2i
Ento...
n2
X
E E h2k y2k net2k x2i y1i net1i
=
w1ij h2k y2k net2k x2i y1i net1i w1ij
k=1
Xn2
E
= h2k (1) f2 (net2k ) w2ki (1) f1 (net1i ) x1j
w1ij
k=1
n2
X
= 1 h2k f2 (net2k ) w2ki f1 (net1i ) x1j
| {z }
k=1 e2k
n2
!
X
= 1 e2k w2ki f1 (net1i ) x1j
k=1
Temos
E
= h1i f1 (net1i ) x1j
w1ij
Substituindo e1i ,
E
= e1i x1j
w1ij
E o bias
Da mesma forma,
E
= e1i
b1i
Resumindo:
1 Introduo
2 Treinamento
3 Treinamento - Teoria
4 Programando
Aproximando Funo
Iris
Clustering
5 Referncias
newff
train
Um exemplo
clear all ;
close all ;
P = [ 0 1 2 3 4 5 6 7 8 9 10];
T = [ 0 1 2 3 4 3 2 1 2 3 4];
figure ;
plot (P , T , rs - , P , Y , o - );
legend ( T , Y ) , xlabel ( P );
12 4
T T
Y Y
10 3.5
3
8
2.5
6
2
4
1.5
2
1
0 0.5
2 0
0 2 4 6 8 10 0 2 4 6 8 10
P P
As Famosas Iris
O conjunto conhecido como Iris flower data set ou Fishers Iris data
set foi apresentado por Sir Ronald Fisher (1936) como um exemplo de
anlise discriminante.
Tambm conhecido por Andersons Iris data set porque Edgar
Anderson coletou os dados para quantificar as variaes morfolgicas
de trs espcies das flores Iris.
Duas das trs espcies foram coletadas na pennsula Gasp (Canad)
sendo todas do mesmo local, coletadas no mesmo dia e medidas ao
mesmo tempo, pela mesma pessoa, com os mesmos aparelhos.
As Famosas Iris
% Plot
p l o t p e r f( tr )
p l o t f i t( net , inputs , t a r g e t s)
p l o t r e g r e s s i o n ( targets , o u t p u t s)
Exemplo Iris
Definindo os dados
% number of sample of each class
K = 100;
% Define 4 c l u s t e r s of input data
q = 0.6; % offset of c l a s s e s
A = [ rand (1 , K ) - q ; rand (1 , K ) + q ];
B = [ rand (1 , K ) + q ; rand (1 , K ) + q ];
C = [ rand (1 , K ) + q ; rand (1 , K ) - q ];
D = [ rand (1 , K ) - q ; rand (1 , K ) - q ];
figure (1);
plot ( A (1 ,:) , A (2 ,:) , k + );
hold on ;
plot ( B (1 ,:) ,B (2 ,:) , b * );
plot ( C (1 ,:) , C (2 ,:) , kx );
plot ( D (1 ,:) , D (2 ,:) , bd );
text (.5 -q , .5+2* q , Class A );
text (.5+ q , .5+2* q , Class B );
text (.5+ q , .5 -2* q , Class C );
text (.5 -q , .5 -2* q , Class D );
Class A Class B
1.5
0.5
0.5
Class D Class C
1
1 0.5 0 0.5 1 1.5 2
Codificao
% P r e p a r e inputs and o u t p u t s f o r n e t w o r k t r a i n i g
% define inputs ( c o m b i n e s a m p l e s from all four c l a s s e s)
P = [ A B C D ];
% define t a r g e t s
T = [ repmat (a ,1 , length ( A )) repmat (b ,1 , length ( B )) ...
repmat (c ,1 , length ( C )) repmat (d ,1 , length ( D )) ];
% create a neural n e t w o r k
net = newff ( minmax ( P ) , minmax ( T ) , [5 3]);
% train net
net . d i v i d e P a r a m . t r a i n R a t i o = 1; % t r a i n i n g set %
net . d i v i d e P a r a m . v a l R a t i o = 0; % v a l i d a t i o n set %
net . d i v i d e P a r a m . t e s t R a t i o = 0; % test set %
% train
[ net , tr , Y , E ] = train ( net , P , T );
view ( net );
Avaliao
% E v a l u a t e n e t w o r k p e r f o r m a n c e and plot r e s u l t s
[ m , i ] = max ( T ); % Target class
[ m , j ] = max ( Y ); % p r e d i c t e d class
N = length ( Y ); % number of all s a m p l e s
k = 0;
i f find (i - j ) , % i f there exist m i s c l a s s i f i e d s a m p l e s
k = length ( find (i - j )); % get the n u m b b e r of m i s c l a s s i
end
f p r i n t f( C o r r e c t c l a s s i f i e d s a m p l e s: %.1 f %% s a m p l e s\ n ,
% Plot n e t w o r k output
figure ;
s u b p l o t (211);
plot ( T );
title ( T a r g e t s );
ylim ([ -2 2]);
grid on ;
s u b p l o t (212);
plot ( Y );
title ( N e t w o r k r e s p o n s e );
xlabel ( # sample );
ylim ([ -2 2]);
grid on ;
Respostas da rede
Targets
2
2
0 50 100 150 200 250 300 350 400
Network response
2
2
0 50 100 150 200 250 300 350 400
# sample
Grficos
Resumo Seo
1 Introduo
2 Treinamento
3 Treinamento - Teoria
4 Programando
Aproximando Funo
Iris
Clustering
5 Referncias
Referncias II
J. J. Hopfield.
Neural networks and physical systems with emergent collective
properties.
In Proceedings of the National Academy of Sciences, volume 79, pages
25542558, 1982.
W. S. McCulloch and W. Pitts.
A logical calculus of the ideas immanent in nervous activity.
Bulletin of Mathematical Biophysics, 5:115133, 1943.
M. Minsky and S. Papert.
Perceptrons: an introduction to computational geometry.
MIT Press, Massachusetts, 1969.
F. Rosenblatt.
The perceptron: a probabilistic model for information storage and
organization in the brain.
Psychol. Review, 65:386408, 1958.
D. E. Rumelhart, G. E. Hinton, and R. J. Williams.
Learning representantions by back-propagation errors.
Nature, 323:533536, 1986.
doi:10.1038/323533a0.
B. Widrow and M. E. Hoff.
Adaptative switching circuits.
Western Electronic Show and Convention, Institute of Radio Engineers,
1960.
Referncias IV
The End