hello everyone in this video tutorial we
are going to look how to create a script
for creating a pattern recognition neural network in MATLAB so I have
already written the code let's see what
it does so I will be creating a random
matrix containing two rows and thousand
columns so thousand will be the number
of samples and the first row values
represent the x-axis and the second row
will represent the y-axis so what I will
be doing is that dividing the space that
I have created into four segments A B C
and D as can be seen in the figure and
then i will be training the pattern
recognization neural network with this
set of data then I will pick any random
point from this data and test in
classification network that I have
created for the accuracy so this is how
I created the random set of integers by
using the random teaser MATLAB command
then these are some variables then I am
using the for loop and the if statement
for divided into the four different
matrices do note that the constraints
that I have given will lead to the
overlapping of some of the data points
in different subsets and that will be
good because in real life data also
there is overlapping of data so these
four if statement divide the data I have
created into four different matrices
then I creating the target matrices by
giving the four rows and thousand
columns one in the first row value
present that it belongs to the Class A
one in the second row will represent
that it belongs to Class B and so on and
then here I will be combining the
different classes that I have created
for both input and target here I create
the pattern recognition neural
network so for that I have given the
training function to NSA D you can also
use trained RP hidden layer size ten
neurons in the only hidden layer that I
am choosing pattern it is the inbuilt
MATLAB command for creating the pattern recognition neural network divide
function is using divide randomly let us
divide mode B sample this is the
training ratio validation duration and
test station Duration I have given do note
that we are using the cross intro fiesta
performance function and note the mean
square error
then I am going to train the network
with the Train command for providing it
to the network the input and the target
then we calculate the output of the
network by supplying it at input so as
to calculate the error and finally the
performance of the network then we can
calculate the percentage error also then
we are recalculating the performance
this is done so that we can remove the
bad data that we have in our input data
set now after the above steps the
network has been created and also
trained so now we need to test the
network so let's choose the 15 percent
test data that the MATLAB has created by
using did test indices and then provided
it in the input to get the value of
input at those test indices then these
commands shows the plotting of the
graphs to check the accuracy of the
network visually so let's run this code
and see what happens so after the
training is complete the window will
look like this I have already discussed
all these parameters will let's look at
the receiver operating characteristic
since the graph follows the left-hand
side and the area under it's nearly
maximum that is 1 so it means the
network is trained route and the
classification accuracies also high
let's change the confusion plot as you
can see for training the accuracy 100%
for validation in 99.3% and for training
it is 98% this is the plot that I have
created using the commands so in this
the first of the vertical section is for
Class A the second is for Class B third
is for plus C and fourth is for Class D
so the line at point five means that
there are 50% or more than death chances
that it belongs to the Class A or B or C
or D so as we can see that there is one
point misclassified so it should be
belonging to the Class A but it is shown
not to belong to Class A it can also be
seen from the conclusion plot of the of
the test division so as you can see it
is written one here similarly for the
Class B there are two points so there
are two here
and for third there is for Class C there
is no point so it will be zero and
similarly for Class B
moreover we can check the performance of
the network by looking into the command
window so as you can see then
performance of all Network is zero point
zero zero four three and we can also
check performance individually phone
trained performance validation
performance and they test performance
and in the workspace you can see the
percentage error of zero point zero zero
four zero this is how okay a script for
creating the pattern recognition
neural network this is just a simple
example of showing how it can be used to
differentiate between four different
classes more complex examples are
available in which the Jews of pattern
recognization application is there and
those example will be discussed in the
later videos so that's it everyone
this is it for this video hope you liked
it and please like subscribe and share
thanks for watching
