Saturday, March 22, 2014

Neural Networks Matlab

neural networks matlab
using NNTOOL
here we will be training a network to recognize a particular pattern
first we have to normalize the data.......
let the data be (X)
2 5 6 3 1
5 2 2 5 1
4 4 5 4 4
1 5 2 4 5
1 6 6 6 6
3 6 3 2 1
6 4 2 5 4
3 1 2 5 3
4 1 4 3 1
2 2 3 4 3

each column a particular pattern
first find the minimum value from each column and subtract
the same then divide the whole column with the max value (column)
ull get data something like this (x)

0.5822 0.5447 0.4046 0.6963 0.3477
0.5407 0.6473 0.4484 0.0938 0.1500
0.8699 0.5439 0.3658 0.5254 0.5861
0.2648 0.7210 0.7635 0.5303 0.2621
0.3181 0.5225 0.6279 0.8611 0.0445
0.1192 0.9937 0.7720 0.4849 0.7549
0.9398 0.2187 0.9329 0.3935 0.2428
0.6456 0.1058 0.9727 0.6714 0.4424
0.4795 0.1097 0.1920 0.7413 0.6878
0.6393 0.0636 0.1389 0.5201 0.3592



let the output of each pattern be(y)
0.7363 0.3947 0.6834 0.7040 0.4423
output corresponding to each column,normalized
x(:,1)-->y(1,1)
x(:,2)-->y(1,2) lly

type nntool at matlab command window another window named
Network/Data Manager will open (1.jpg)


click on import button and export x as input data and y as target data !
half way !!! ;)
ull get a message like this (2.jpg)
after this close import window ,now ur network/data manager window will look like this (3.JPG)

now click on new button ull see another window here u have to select the type of NN u want to create
we will be create a feedforward back propagation NN most popular one
der u select the inputs and target data (4.JPG)

then click on create and close that window
now u should be able to see a network in network/data manager window(middle)
click on that newly created network (icon) then click on open
ull see another window (5.jpg)
click on train tab -> then training info
add inputs and targets as x,y then click on train network ....wait for some time ull see a graph once the
goal is met click on stop training button and close that graph and this window ..
now our NN is trained and is read for testing ........ hurray
after this click on export button in network/data manager ....
now close this window ..u should be able to see ur trained network in ur matlab work space......

now use this command
output=sim("networkname","data")
example
output=sim(network1,x(:,1))
which should be same as y(1,1)
u can test ur network reliability by adding noise .....
ur rand function for this purpose

thats it ........
thks






No comments:

Post a Comment