lab 1 neural network
TRANSCRIPT
-
8/13/2019 LAB 1 Neural Network
1/37
AIM: To understand fuzzy logic system by using Matlabs Fuzzy Logic toolbox.
1.0 OBJECTIVES
After completing this units, students should be able to:
. To determine fuzzy !ariables, form the rule base and use fuzzy reasoning to chec"
the operability of the rule base.
#. To construct fuzzy logic system by using Matlabs fuzzy logic toolbox.
2.0 THEORY
$lease refer lectures notes.
3.0 EQUIPMENT LIST:
%. $ersonal computer %.# Matlab Fuzzy Logic Toolbox
4.0 EXPERIMENT PROCEDURE
Tas 1 : T!""!#$ "%&'()*
The &uality of ser!ice in restaurant is e!aluated according to scale '(', )here ' mean
excellent and ' poor ser!ice. The &uestion is, ho) much tip )e should gi!e, that the relationbet)een tip and ser!ice is correct. *reate F+ )ith -+ follo)ing rules belo)/
There are three main rules:
i0 +f the ser!ice is poor, the tip is cheap.
ii0 +f the ser!ice is good, the tip is a!erage.
iii0 +f the ser!ice is excellent, the tip is generous.
According to practice, the cheap tip is 12, a!erage 12 and generous #12 of the total
bill. Formulate fuzzy deduction system 3tip. se Matlab Fuzzy Logic Toolbox.
DEPARTMENT OF COMPUTER ENGINEERING
MASTERS LABORATORY 1(MEE 10501)
LABORATORY REPORT
Code of Coure MEE 10501
N!"e of Coure MASTERS LABORATORY 1
N!"e of S#ude$#
ZAHARI BIN HASAN GE120194
T%#&e of E'er%"e$# NEURAL NETWORK APPLICATION
No of E'er%"e$# CI 02
N!"e of Le*#urer DR ABD. KADIR BIN MAHAMAD
FACULTY OF ELECTRICAL AND ELECTRONIC ENGINEERING
-
8/13/2019 LAB 1 Neural Network
2/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
The F+ )ith -+ )as created referring to the three rules gi!en.
Tas 2: +URNACE TEMPERATURE CONTROL
AIM: T& ,#-)%sa#- s)/)%a( ")s & #),%a( #)&% *&-)(s ' ,s!#$ Ma(a's #),%a(
#)&%&&('&.
1.0 OBJECTIVES
After completing this unit, students should be able:
. To apply some basic neuron models and learning algorithms by using Matlabsneural net)or" toolbox.
#. To demonstrate multi(layer feedfor)ard 4MLFF0 neural net)or"s by using
Matlabs neural net)or" toolbox.
%. To practice clustering )ith a self(organizing feature map and pattern association
)ith a 5opfield net)or".
2.0 THEORY
$lease refer lectures notes.
3.0 EQUIPMENT LIST:
%. $ersonal *omputer
%.# Matlab 6eural 6et)or" Toolbox
4.0 EXPERIMENT PROCEDURE
7efer to Labsheet
JEP, FKEE (Semester 1 2012/2013) #
-
8/13/2019 LAB 1 Neural Network
3/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
5.0 RESULT AND DISCUSSION
TOPIC 1 : SIMPLE NEURON MODELS AND LEARNIN6 AL6ORITHMS
TAS7 1 : DEMONSTRATION IN MATLAB
A. S!*"() #),% a#- %a#s)% ,#8!s
JEP, FKEE (Semester 1 2012/2013) %
-
8/13/2019 LAB 1 Neural Network
4/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
For the first tas", $urelin transfer function )as selected. The )eight and bias of # are pic"ed.The output are li"e belo):
8ith the same transfer function, )e!e changed the bias into '.
JEP, FKEE (Semester 1 2012/2013) 9
-
8/13/2019 LAB 1 Neural Network
5/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
8e can se that the border line changed by (axis to '. Then )e changed the )eight to .
JEP, FKEE (Semester 1 2012/2013) 1
-
8/13/2019 LAB 1 Neural Network
6/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
8e can see that the degree of gradient changed depending on the )eight !alue
1. H& 9) )!$9s a#- '!as /a(,)s a)8 9) &,", & a #),%.
The )eight are the !alue of the m, that is the gradient of the border line. 8hile the bias
is the !alue of c, that is the border line interception on (axis.
6ext, 5ardlim transfer function )as selected. The )eight and bias of # are pic"ed. The output
are li"e belo):
JEP, FKEE (Semester 1 2012/2013) ;
-
8/13/2019 LAB 1 Neural Network
7/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
The hardlimit function graph are little bit bac")ard in
to '.
The output seems li"e are all !alue of . Then )e changed the bias !alue to '
The output became li"e figure and )e can see there are area of ' !alue and !alue. Then
changed )eight !alue to (#.
JEP, FKEE (Semester 1 2012/2013) =
-
8/13/2019 LAB 1 Neural Network
8/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
The output sho)n the !alue of in the negati!e side. Then )e changed the bias !alue to (#.
The output sho) hardlimit !alue in negati!e side
JEP, FKEE (Semester 1 2012/2013) >
-
8/13/2019 LAB 1 Neural Network
9/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
1. H& 9) )!$9s a#- '!as /a(,)s a)8 9) &,", & a #),%.
The )eight determine the side of positi!e !alue )here )hen )eight !alue is positi!e, the
!alue of are to)ard positi!e area and !ice !ersa. 8hile the bias determining the point
of !alue change from ' to . 8hen the bias !alue is positi!e, the change point of !alue is
in the negati!e area and !ice !ersa.
B. N),% !9 /)8&% !#",
JEP, FKEE (Semester 1 2012/2013) ?
-
8/13/2019 LAB 1 Neural Network
10/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
Ha%-(!* a#- Ha%-(!*s %a#s)% ,#8!s.
a 1 a 1
P,%)(!# a#- Sa(!# %a#s)% ,#8!s.
a 3 a 1
Sa(!#s a#- L&$s!$ %a#s)% ,#8!s.
JEP, FKEE (Semester 1 2012/2013) '
-
8/13/2019 LAB 1 Neural Network
11/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
a 1 a 1
Ta#s!$ %a#s)% ,#8!s.
a 1
2. H& 9) 89&!8) & a8!/a! ,#8! ;&% %a#s)% ,#8!< a)8s 9) &,", & a
#),%.E")%!*)# !9 9) &((&!#$ ,#8!s: !-)#! ;",%)(!#
-
8/13/2019 LAB 1 Neural Network
12/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
9%)s9&(- ;9a%-(!*= 9a%-(!*s
-
8/13/2019 LAB 1 Neural Network
13/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
Learn button8ithout bias )ith bias
JEP, FKEE (Semester 1 2012/2013) %
-
8/13/2019 LAB 1 Neural Network
14/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
JEP, FKEE (Semester 1 2012/2013) 9
-
8/13/2019 LAB 1 Neural Network
15/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
JEP, FKEE (Semester 1 2012/2013) 1
-
8/13/2019 LAB 1 Neural Network
16/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
JEP, FKEE (Semester 1 2012/2013) ;
-
8/13/2019 LAB 1 Neural Network
17/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
JEP, FKEE (Semester 1 2012/2013) =
-
8/13/2019 LAB 1 Neural Network
18/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
3. H& -)8!s! '&,#-a% 89a#$)s -,%!#$ %a!#!#$ !9 9) ")%8)"% ()a%#!#$ %,().
@ecision boundary changes by testing e!ery points until its satisfy each point.
D. C(ass!!8a! !9 a 2>!#", ")%8)"%
JEP, FKEE (Semester 1 2012/2013) >
-
8/13/2019 LAB 1 Neural Network
19/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
4. H& 9) ")%8)"% ()a%#!#$ %,() &%s &% (!#)a%( s)"a%a'() "%&'()*s.
For linearly separable problems, perceptron learning rule )or"s by di!iding the area by
classified input.
E. L!#)a%( #>s)"a%a'() /)8&%s
JEP, FKEE (Semester 1 2012/2013) ?
-
8/13/2019 LAB 1 Neural Network
20/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
5. H& 9) ")%8)"% ()a%#!#$ %,() &%s &% #>(!#)a%( s)"a%a'() "%&'()*s.
The perceptron learning rule test all the point and cannot classify the input by di!iding the
area as there are no linear border to classify the input.
TAS7 2 : TRAININ6 THE PERCEPTRON
@uring this tas" )e ha!e to study the beha!ior of the perceptron learning rule in t)o
JEP, FKEE (Semester 1 2012/2013) #'
-
8/13/2019 LAB 1 Neural Network
21/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
difference classification problems.
$ data. T data.
$ data. T data.
The output $ e!en after ''' epoch
JEP, FKEE (Semester 1 2012/2013) #
-
8/13/2019 LAB 1 Neural Network
22/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
The output $# e!en after ''' epoch
1. D&)s 9) %a!#!#$ 8/)%$)?
nly $ can con!erge.
JEP, FKEE (Semester 1 2012/2013) ##
-
8/13/2019 LAB 1 Neural Network
23/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
2. Is 9) ")%8)"% a'() & 8(ass! a(( %a!#!#$ /)8&%s 8&%%)8( a)% %a!#!#$?6o
3. I #&= 9?
Because the !ectors cannot be classified and di!ided by linear line
4. Ca# &, sa s&*)9!#$ a'&, 9) ")%8)"%s a'!(! & 8(ass! #) ,##
"a)%#s? ;#&) 9) "&s!! & 9) -)8!s! (!#)e(9
9'' 9.#9e(';
1'' 9.'=e(';
;'' #.'>e('?='' 9.'e('=
>'' .=#e(';
?'' .>%e('1
''' .;%e('1
#. *omment the result: The expected !alue of the s&uared error loss or &uadratic loss. MC
JEP, FKEE (Semester 1 2012/2013) #9
-
8/13/2019 LAB 1 Neural Network
25/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
measures the a!erage of the s&uares of the Derrors.D
Cpoch E '', MC E 9.;9e('; Cpoch E #'', MC E #.9;e('>
Cpoch E %'', MC E .'>e(9 Cpoch E 9'', MC E 9.#9e(';
Cpoch E 1'', MC E 9.'=e('; Cpoch E ;'', MC E #.'>e('?
JEP, FKEE (Semester 1 2012/2013) #1
-
8/13/2019 LAB 1 Neural Network
26/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
Cpoch E ='', MC E 9.'e('= Cpoch E >'', MC E .=#e(';
JEP, FKEE (Semester 1 2012/2013) #;
-
8/13/2019 LAB 1 Neural Network
27/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
Cpoch E ?'', MC E .>%e('1 Cpoch E ''', MC E .;%e('1
%. 7epeat the experiment.
E"&89 MSE;)s1< MSE;)s2 >.1=e('1
%'' .'>e(9 .>?e('>
9'' 9.#9e('; '.'''#?91'' 9.'=e('; =.;#e(#'
;'' #.'>e('? .%#e(';
='' 9.'e('= ;.>1e('>
>'' .=#e('; #.>9e('
?'' .>%e('1 ;.>1e('>
''' .;%e('1 %.'9e('1
*ommnet
6ot consistence , the result depend an estimator is one of many )ays to &uantify the
difference bet)een !alues implied by an estimator and the true !alues of the &uantity being
estimated.
JEP, FKEE (Semester 1 2012/2013) #=
-
8/13/2019 LAB 1 Neural Network
28/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
Cpoch E '', MC E '.'''#1 Cpoch E #'', MC E '.'''#1
Cpoch E %'', MC E .>?e('> Cpoch E 9'', MC E '.'''#?9
JEP, FKEE (Semester 1 2012/2013) #>
-
8/13/2019 LAB 1 Neural Network
29/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
Cpoch E 1'', MC E =.;#e(#' Cpoch E ;'', MC E .%#e(';
Cpoch E ='', MC E ;.>1e('> Cpoch E >'', MC E #.>9e('
JEP, FKEE (Semester 1 2012/2013) #?
-
8/13/2019 LAB 1 Neural Network
30/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
Cpoch E ?'', MC E ;.>1e('> Cpoch E ''', MC E %.'9e('1
TAS7 2 : +UNCTION APPROXIMATION
JEP, FKEE (Semester 1 2012/2013) %'
-
8/13/2019 LAB 1 Neural Network
31/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
-eneralization +n!estigate ho) the number of neurons affects the ability of a MLFF to
generalize 4that is, to classify unseen pattern !ectors0. The tas" of the net)or" is toapproximate the follo)ing function
y E x '.% sin4# x0
For this tas" )e are trying to )or" out )ith the code belo)/
1. P(& 9) %)s,( !# 9) sa*) $%a"9 9a &, 9a/) ,s)- &% "(&!#$ 9) ,#8! a#-
%a!#!#$ -aa=!.).= "(& as a ,#8! & ;).$.= %)- (!#)
-
8/13/2019 LAB 1 Neural Network
32/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
6umber of neuron in hidden layer E
*omment:
The approximation is good because the net)or" reaches its maximum capabality.
2. D& 9) sa*) !#!!a(!a!= %a!#!#$ a#- )s!#$ "%&8)-,%) as a'&/) ', &%
-!)%)# #,*')% & #),%s !# 9) 9!--)# (a)%: 2=3=4=5===F=G=10 a#- 50. T9)
$%a"9 & 9) a""%&!*a! &$)9)% !9 9) %)a( ,#8! a#- %a!#!#$ -aa
s9&,(- ') "%)s)#)- !# 9) %)"&%. D!s8,ss 9) $)#)%a(!a! ")%&%*a#8) & 9)
#)&% !# )a89 8as) ).$.= -&)s ! ,#-)%! &% &/)%! 9) -aa?
JEP, FKEE (Semester 1 2012/2013) %#
-
8/13/2019 LAB 1 Neural Network
33/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
6um of neuron in hidden layer E# 6um of neuron in hidden layer E%
6um of neuron in hidden layer E9 6um of neuron in hidden layer E 1
JEP, FKEE (Semester 1 2012/2013) %%
-
8/13/2019 LAB 1 Neural Network
34/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
6um of neuron in hidden layer E ; 6um of neuron in hidden layer E =
6um of neuron in hidden layer E > 6um of neuron in hidden layer E ?
JEP, FKEE (Semester 1 2012/2013) %9
-
8/13/2019 LAB 1 Neural Network
35/37
F!*u+ of E&e*#r%*!& !$d E&e*#ro$%* E$,%$eer%$,
Ex!"#$!%& ' CI 02 ( )UZZY LOGIC APPLICATION
6um of neuron in hidden layer E ' 6um of neuron in hidden layer E 1'
O's)%/a!:
As )e can see from the graf, )hen the !alue of hidden neuron is increasing the the
net)or" reaches its maximum capabilty. The mean s&uare error is minimized , but the
net)or" response is only able to match a small part of the function.
3. 9!89 #)&% $a/) 9) ')s %)s,(s? Y&, s9&,(- a(s& s9& a a'() &% $%a"9
s9&!#$ 9) SSE a$a!#s 9) #,*')% & 9!--)# #),%s.
N,* &
N),%
!# 9)
H!--)#
La)%
SSE;")%&%*a#8)