www.ShoppingPodder.com

Leading Computer Shopping,
News and information


Part of the Identityscape.com network...

getxfactor.com jmoodmusic.com smartbusinesschoices.com mintdepot.com lowfaresalways.com evangelicalview.com shoppingpodder.com soproudlywehail.com webnews.ws currenthumor.com

 

 

NN training using simple perceotron rule
   Shopping Podder - the Best of Computer Postings! Forum Index -> Computer Artificial Intelligence - Neural Nets  
View previous topic :: View next topic  
Author Message
Berdakh Abibullaev
Guest






PostPosted: Mon Oct 27, 2008 1:12 am    Post subject: NN training using simple perceotron rule Reply with quote

Hello ,

I am learning Neural Networks and very new in this area. Thus, I want
to train one neuron perceptron with simple perceptron rule. There are
four inputs p(1,Smile,p(2,Smile,p(3,Smile,p(4,Smile and two target outputs as
t[1,1,0,0] . I am using hardlim transfer function. Can you please
check my matlab code below and correct my mistakes.

Thanks!
---------------------------------------
clear all; close all;
% set input vectors
p = [-1,1; -1,-1; 0,0; 1,0];
% define target values
t = [1,1,0,0];
% set initial weights and bias
w = [0,0]; b = 0;
ii = 0; jj = 0; nn = 1;
aa = rand(1,4);

% start training the network
while jj == 0

fprintf('\nProcessing...\n')

if nn > 4
nn = 1;
end
pp = nn;

n = w*p(nn,1:2)' + b;

% here we threshold using transfer function in our case a =
harlim(n)
if n >= 0
a = 1;
elseif n < 0
a = 0;
end

% now calculate the error e = (t-a)
if pp == 1
e = t(1,1)-a;
aa(1,pp) = e;
elseif pp ==2
e = t(1,2)-a;
aa(1,pp) = e;
elseif pp == 3
e = t(1,3)-a;
aa(1,pp) = e;
elseif pp == 4
e = t(1,4)-a;
aa(1,pp) = e;
end

% following the step we update weight and bias
w = w+e*p(nn,1:2)+b;
b = b + e;


if aa(1,Smile == t(1,Smile
disp('Completed')
jj = 1;
end

nn = nn + 1;

end
Back to top
Display posts from previous:   
   Shopping Podder - the Best of Computer Postings! Forum Index -> Computer Artificial Intelligence - Neural Nets  
Page 1 of 1
All times are GMT

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum