Pattern Recognition with Perceptron

3 visualizaciones (últimos 30 días)
Bernard
Bernard el 26 de En. de 2012
Hi, all
I have six patterns as shown below
A1 = [ 0 0 1 1 0 0 0;
0 0 0 1 0 0 0;
0 0 0 1 0 0 0;
0 0 1 0 1 0 0;
0 0 1 0 1 0 0;
0 1 1 1 1 1 0;
0 1 0 0 0 1 0;
0 1 0 0 0 1 0;
1 1 1 0 1 1 1];
B1 = [ 1 1 1 1 1 1 1;
1 0 0 0 0 0 1;
1 0 0 0 0 0 1;
1 0 0 0 0 0 1;
1 1 1 1 1 1 1;
1 0 0 0 0 0 1;
1 0 0 0 0 0 1;
1 0 0 0 0 0 1;
1 1 1 1 1 1 1];
C1 = [ 0 0 1 1 1 1 1;
0 1 0 0 0 0 1;
1 0 0 0 0 0 0;
1 0 0 0 0 0 0;
1 0 0 0 0 0 0;
1 0 0 0 0 0 0;
1 0 0 0 0 0 0;
0 1 0 0 0 0 1;
0 0 1 1 1 1 0];
A2 = [ 0 0 0 1 0 0 0;
0 0 0 1 0 0 0;
0 0 0 1 0 0 0;
0 0 1 0 1 0 0;
0 0 1 0 1 0 0;
0 1 0 0 0 1 0;
0 1 1 1 1 1 0;
0 1 0 0 0 1 0;
0 1 0 0 0 1 0];
B2 = [ 1 1 1 1 1 1 0;
1 0 0 0 0 0 1;
1 0 0 0 0 0 1;
1 0 0 0 0 0 1;
1 1 1 1 1 1 0;
1 0 0 0 0 0 1;
1 0 0 0 0 0 1;
1 0 0 0 0 0 1;
1 1 1 1 1 1 0];
C2 = [ 0 0 1 1 1 0 0;
0 1 0 0 0 1 0;
1 0 0 0 0 0 1;
1 0 0 0 0 0 0;
1 0 0 0 0 0 0;
1 0 0 0 0 0 0;
1 0 0 0 0 0 1;
0 1 0 0 0 1 0;
0 0 1 1 1 0 0];
I have to recognize these patterns with artificial neural network.
I am new in Matlab. Please help!
I need to divide this data into 2 groups.
The first group A1, B1, C1 as training data. The second group A2, B2, C2 used to validate/test the network.
Example : if I select A1 then the output must display 'A', if I select B1 then the output must display 'B', if I select A2 then the output must display 'A'.
. . # # . . .
. . . # . . .
. . . # . . .
. . # . # . .
. . # . # . . => This pattern should be recognized as A
. # # # # # .
. # . . . # .
. # . . . # .
# # # . # # #
How do I do that?
Thanks in advance!
Network type is perceptron

Respuesta aceptada

Chandra Kurniawan
Chandra Kurniawan el 26 de En. de 2012
Hi, Benard
A perceptron can be created with the newp function.
Eq: net = newp(PR,S,TF,LF);
- PR is m x 2 matrix of [min max] of network input
- S is a scalar that indicates number of target/pattern
- TF is transfer function. Default is 'hardlim'
- LF is learning function. Default is 'learnp'
In order to divide your data into 2 groups, you need to select A1, B1, C1 as network input.
p = [A1(1:end); B1(1:end); C1(1:end)]';
And to create the network target
t = eye(3);
Then, use train to perform network training. You can also set the network epoch by :
net.trainParam.epochs = 10;
So, the complete code is :
p = [A1(1:end); B1(1:end); C1(1:end)]';
t = eye(3);
PR = zeros(63,2);
PR(:,2) = 1;
net = newp(PR,3,'hardlim','learnp');
net.trainParam.epochs = 10;
net = train(net, p, t);
And about how to test your network just use sim command.
a = sim(net, A2(1:end)');
Now, do testing for A1 and A2. Both of them will display :
>> a = sim(net, A2(1:end)')
a =
1
0
0
>> a = sim(net, A1(1:end)')
a =
1
0
0
  5 comentarios
Bernard
Bernard el 26 de En. de 2012
Thank you!
Greg Heath
Greg Heath el 26 de En. de 2012
If you have the typical problem of identifying the 26 alphabet characters and 10 digits, you will probably need to add a hidden layer via newff or patternnet.
Hope this helps.
Greg

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by