Artificial Neural Network employs the ability of the brain to learn and classify objects that is fed on to the system. The idea is that the algorithm learns by itself from the examples or training sets that are given to it. Once the network learns from the examples, it can easily identify classes that are presented to it with higher processing speed.
The input layer is where the features are fed and the hidden layer process these features by having interconnected neurons after the preceding input layer. Then the output layer integrates the learning process and gives the learned classification.
Detailed explanation and examples are presented to Cole's Blog.
In my previous activities, I classified the 25c and P1 coins using Minimum Distance Classification and Linear Discriminant Analysis and found out that LDA presents better classification accuracy compared to MDC. In this activity, I'll try to compare ANN classification with the previous algorithm.
Again, the rg values of my samples are the features used to classify the classes. Here are some sample images of my objects:
To analyze the results, I preferred to present them visually. Here are the results of my ANN:
Black = 0 and white = 1. The left image is the input training class. Black means that it is of class P1 coin and white of class 25c coin. The black boundary is meant for visualizing the white part. The right image is the output classification. Grayscaling is observed since the output is not an integer. The outputs are close to 0 and 1. This set presents an arranged training classes for the algorithm to learn. That is, ANN learns the P1 coin features first an next are the 25c coin features. This training style exhibits 100% classification accuracy. Next is we determine if the arrangement of training classes affect the accuracy of the ANN.
The left image is the input training style and the output is at the right. This presents that even if we scramble the training class style, a 100% accuracy classification is still obtained. Thus, ANN presents a more flexible way of classification compared to LDA and MDC. Also, no stricter assumptions are carried into the algorithm unlike LDA which assumes that objects are linearly separable. Also, this algorithm trains and learns itself an accurate way of classification.
I give myself 10 pts for understanding and doing the activity correctly.
Reference:
A16 - Neural Networks handout. M. Soriano, 2008.
Acknowledgement:
I acknowledge M. Sison for the gift I received from him in debugging the problem for ANN toolbox. ;)
Code:
chdir('E:\Documents and Settings\vergara\My Documents\acads\1st sem 09-10\186\act14\' + 'data');
x1 = fscanfMat('piso_t.txt');
x2 = fscanfMat('ben_t.txt');
fname = 'piso';
tst1 = fscanfMat(fname + '_t.txt');
fname = 'ben';
tst2 = fscanfMat(fname + '_t.txt');
rand('seed',0);
N = [2,2,1];
//x = cat(1, x1(:,1:2), x2(:,1:2))';
//set 1
x = cat(1, tst1(:,1:2), tst2(:,1:2))';
t = [0 0 0 0 0 1 1 1 1 1];
//set 2
x=cat(1,tst1(1:2,1:2),tst2(1:2,1:2),tst1(3:4,1:2),tst2(3:4,1:2),tst1(5,1:2),tst2(5,1:2))';
t = [0 0 1 1 0 0 1 1 0 1];
lp = [4, 0];
W = ann_FF_init(N);
T = 1000;
W = ann_FF_Std_online(x,t,N,W,lp,T);
//results
c = ann_FF_run(x,N,W)';
t = mtlb_repmat(t', [1,50]); //input
c = mtlb_repmat(c, [1 50]); //output
//boundary
c(:,1:2) = 0; c(:,49:50) = 0; t(:,1:2) = 0; t(:,49:50) = 0;
scf(), imshow(t, [])
scf(), imshow(c, [])
Again, the rg values of my samples are the features used to classify the classes. Here are some sample images of my objects:
To analyze the results, I preferred to present them visually. Here are the results of my ANN:
Black = 0 and white = 1. The left image is the input training class. Black means that it is of class P1 coin and white of class 25c coin. The black boundary is meant for visualizing the white part. The right image is the output classification. Grayscaling is observed since the output is not an integer. The outputs are close to 0 and 1. This set presents an arranged training classes for the algorithm to learn. That is, ANN learns the P1 coin features first an next are the 25c coin features. This training style exhibits 100% classification accuracy. Next is we determine if the arrangement of training classes affect the accuracy of the ANN.
The left image is the input training style and the output is at the right. This presents that even if we scramble the training class style, a 100% accuracy classification is still obtained. Thus, ANN presents a more flexible way of classification compared to LDA and MDC. Also, no stricter assumptions are carried into the algorithm unlike LDA which assumes that objects are linearly separable. Also, this algorithm trains and learns itself an accurate way of classification.
I give myself 10 pts for understanding and doing the activity correctly.
Reference:
A16 - Neural Networks handout. M. Soriano, 2008.
Acknowledgement:
I acknowledge M. Sison for the gift I received from him in debugging the problem for ANN toolbox. ;)
Code:
chdir('E:\Documents and Settings\vergara\My Documents\acads\1st sem 09-10\186\act14\' + 'data');
x1 = fscanfMat('piso_t.txt');
x2 = fscanfMat('ben_t.txt');
fname = 'piso';
tst1 = fscanfMat(fname + '_t.txt');
fname = 'ben';
tst2 = fscanfMat(fname + '_t.txt');
rand('seed',0);
N = [2,2,1];
//x = cat(1, x1(:,1:2), x2(:,1:2))';
//set 1
x = cat(1, tst1(:,1:2), tst2(:,1:2))';
t = [0 0 0 0 0 1 1 1 1 1];
//set 2
x=cat(1,tst1(1:2,1:2),tst2(1:2,1:2),tst1(3:4,1:2),tst2(3:4,1:2),tst1(5,1:2),tst2(5,1:2))';
t = [0 0 1 1 0 0 1 1 0 1];
lp = [4, 0];
W = ann_FF_init(N);
T = 1000;
W = ann_FF_Std_online(x,t,N,W,lp,T);
//results
c = ann_FF_run(x,N,W)';
t = mtlb_repmat(t', [1,50]); //input
c = mtlb_repmat(c, [1 50]); //output
//boundary
c(:,1:2) = 0; c(:,49:50) = 0; t(:,1:2) = 0; t(:,49:50) = 0;
scf(), imshow(t, [])
scf(), imshow(c, [])








0 comments:
Post a Comment