0% found this document useful (0 votes)
62 views6 pages

Neural 123

The document discusses using the perceptron model to create a decision boundary to classify points. It then discusses the Adaline model and backpropagation network. It shows code examples for training these models and evaluating their performance.

Uploaded by

api-3764708
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views6 pages

Neural 123

The document discusses using the perceptron model to create a decision boundary to classify points. It then discusses the Adaline model and backpropagation network. It shows code examples for training these models and evaluating their performance.

Uploaded by

api-3764708
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Nguyễn Thành Chung ðKTð1_K48 Nhóm 1

Contents

• 1.Dung mo hinh mang Perceptron tao ra duong ranh gioi de phan loai cac diem
sau
• 2.Mang Adline (Bo loc tien doan)
• 3.Mang Backpropagation
• In ra cac gia tri W ,b

1.1.Dung mo hinh mang Perceptron tao ra duong ranh gioi de phan loai
cac diem sau

Cach 1 : Huan luyen theo kieu Train

clear;clc;
p = [[-5;5] [-3;4] [1;6] [3;8] [0;3] [-5;-3] [-2;-1] [1;-7] [2;1]
[6;2]];%input
t = [1 1 1 1 1 0 0 0 0 0];%%Target
PR = newp([-5 3;3 8],1);% tao mang 2 dau vao tam [-5 3][3 8] va 1
noron
PR.trainParam.epochs = 5;PR = train(PR,p,t);%Huan luyen mang
a = sim(PR,p);e=t-a;
plotpv(p,t);hold on;plotpc(PR.IW{1,1},PR.b{1});
% In ra cac gia tri W va b
w=PR.IW{1,1}%Trong so
b=PR.b{1}%tri so phan cuc
TRAINC, Epoch 0/5
TRAINC, Epoch 5/5
TRAINC, Maximum epoch reached.

w =

-2 8

b =

-7

Thí nghiệm HTTM [email protected] page 1 of 6


Nguyễn Thành Chung ðKTð1_K48 Nhóm 1

Cach 2 : Huan luyen theo kieu Adaptic

clear;clc;
p = [[-5;5] [-3;4] [1;6] [3;8] [0;3] [-5;-3] [-2;-1] [1;-7] [2;1]
[6;2]];%input
t = [1 1 1 1 1 0 0 0 0 0];%%Target
PR = newp([-5 3;3 8],1);% tao mang 2 dau vao tam [-5 3][3 8] va 1
noron
plotpv(p,t);
e=1;
linehandle = plotpc(PR.iw{1},PR.b{1});
while(sse(e)) [PR,y,e]=adapt(PR,p,t);
linehandle = plotpc(PR.iw{1},PR.b{1},linehandle)
end;
% In ra cac gia tri W va b
w=PR.IW{1,1}%Trong so
b=PR.b{1}%tri so phan cuc

linehandle =

304.0038

linehandle =

Thí nghiệm HTTM [email protected] page 2 of 6


Nguyễn Thành Chung ðKTð1_K48 Nhóm 1

304.0039

w =

-2 8

b =

-5

2.Mang Adline (Bo loc tien doan)


clear;clc;
t=0.1:0.1:10;
T = exp(-0.3*t).*cos(4*pi*t);%Target
P = exp(-0.3*(t-0.1)).*cos(4*pi*(t-0.1));%input
plot(t,P,'r:',t,T,'b-');legend('P','T');grid on;%Kiem tra

Thí nghiệm HTTM [email protected] page 3 of 6


Nguyễn Thành Chung ðKTð1_K48 Nhóm 1

Ada = newlin([-1 1],1);%tao mang theo yeu cau


Ada.trainParam.goal = 0.07;% Sai so cho phep
Ada.trainParam.show = 10;
Ada.trainParam.epochs = 20;%So buoc huan luyen
Ada = train(Ada,P,T);%huan luyen mang
a = sim(Ada,P);e=T-a;%kiem tra dat yeu cau
TRAINB, Epoch 0/20, MSE 0.0782468/0.07.
TRAINB, Epoch 10/20, MSE 0.0719035/0.07.
TRAINB, Epoch 20/20, MSE 0.0709057/0.07.
TRAINB, Maximum epoch reached.

Thí nghiệm HTTM [email protected] page 4 of 6


Nguyễn Thành Chung ðKTð1_K48 Nhóm 1

3.Mang Backpropagation
clear;clc;
p = [0 1 2 3 4 5 6 7 8 9];%input
t = [0.84 0.91 0.14 -0.77 -0.96 -0.28 0.66 0.99 1 1];%target
ff = newff(minmax(p),[3 1],{'tansig','purelin'},'traingd');%tao
mang theo yeu cau
ff.trainParam.show = 200;ff.trainParam.lr =
0.05;ff.trainParam.epochs = 1000;
ff.trainParam.goal = 0.01;%sai so cho phep
ff = train(ff,p,t);%huan luyen mang
a = sim(ff,p);e=t-a;%kiem tra dat yeu cau
TRAINGD, Epoch 0/1000, MSE 0.502565/0.01, Gradient 1.34781/1e-010
TRAINGD, Epoch 200/1000, MSE 0.0294352/0.01, Gradient 0.0599319/1e-
010
TRAINGD, Epoch 400/1000, MSE 0.0131764/0.01, Gradient 0.0265628/1e-
010
TRAINGD, Epoch 526/1000, MSE 0.00999319/0.01, Gradient 0.0188419/1e-
010
TRAINGD, Performance goal met.

Thí nghiệm HTTM [email protected] page 5 of 6


Nguyễn Thành Chung ðKTð1_K48 Nhóm 1

In ra cac gia tri W ,b


w=ff.IW{1,1}%Trong so
b=ff.b{1}%Do phan cuc

w =

-0.7786
0.8727
-0.5578

b =

8.4179
-4.4347
1.3052

Published with MATLAB® 7.0.4

Thí nghiệm HTTM [email protected] page 6 of 6

You might also like