Professional Documents
Culture Documents
ML June July
ML June July
-
• h ~ '•XU11111rnr1011 ( ·1 ~ .
M . , H S - .huu.· / .luly 20t«)
ach•ne learning
I ,11u.·: J ht:-; .
Note: 1t11rn 1t'r 1111y F/J-11:'Ju// tJllc.•,ti Mnx. Murk,; XO
_:_,o1t.\1 \t'ft•c•ti1111 ONJ,.
·-- ,.. ,,/111/ qu,•,,l/011 Jro,11 ,•at·h 11111tl11h•.
Module - I
t. a. l)dinc mad1inc karnino.... Dl's•·•··l ti
• ~ I )(.• ll' Skt)S i I • .
· · n < cMgurn~ lt•aruing system
}\ns. /\ ~ompuh.'r prng1am ,~ ~aid lo k"t. 1.. . (08 Marks)
·n · • l w,t I1 rcspc~l lo some c Iass o I
.. l':\pcr,
tat..k.s I and pcrl'onnanc\! 111 ,. 1 •c, Ill, . IOlll · ~ cc
. l,Mlll: 1,1 1 ,tspctlo1m·111 · • · lt · ·k ·' 1·, ., . ll
P. 1mpro\ cs wtth c~perience f· . ' n ,\l. ,,s s ,n . ,ts mc,1 s 111 e<. >y
Steps involved in desi 0 ning k·,rnino . ·t
, • • ~ ' c::, S) s cm arc
l. ( hoosmg the tranung t•xpcriencc:-
Thc first choice is to choose the t , f .. · · • • • ·
)pc o lt,ltntno c:-..pcn'--·ncc lrom \.\lll'·h S)'Sten1 will
learn. c:- "" • •
l'hc
• •
t) pc ,of training c~pcricncc 'ava·1, t I• .. l · · ·· ·
• I tl) C i.;,\l) l,\VC i\ s1gn1ftcnnt lllltJad on 'illCCCSS or
tatlurc ol the learner.
E~amplc:- In learning to play checkers.
rack r: phasing checkers
Performance measure P: percent of games won in the \\Urld tourmm,cnt
Tr:ainin~ C\.pericncc E: Garnes played against itself. In order to complct~ the design
ot learnmg S) ~tem \\e must no,.., choose
I. l'he c\.act t) pc of k.nov. lcdgc to be lcim1cd
2. Rcprc~cntat ion for this target knowkdg.c
3. /\ learning mechanism
2. Choosing th~ target function:-
l'hc ne\.t design dwice is to tktcnninc c~adl) what type or k.nowlcdgc '" ill be
learned and ho\\ this "ill be used by the pcrfonnam:c program let us begin with
checkers playing program that can generate legal moves from an) board state The
program needs only to learn how to chase the best moves among these legal mm cs.
We must learn to choose among the legal mows the choice for the t) pc of inforn1.1tion
to b~ learned is a fun ct ion, that choose the best move for any given board state
Let us call this function choose move and use the notation choos~ mo\-C : B ~➔ M to
indicate that this function accepts as input any board from the set of legal board state
B and produces the output as some move from legal mo\ e M.
Ihc choice of target function will be the kc) design choice choose mm c ts ob\ ious
choice for target function this function is ditlicult to learn.
An alternative target function will turns out to be easier to learn it is an ~caluntion
function that assigns a numerical score to any given board stntc.
Let us call this target tune non V and again use the notation V:B -- K
23
M ~ LWA'"~
VLI S0t-rv (LSI/ESI)
I. If bis final board state that 1~ won v(b) = 100
2. Ifb is a final board statt that is lost v(b)=-100
3.lfbisatinalboardstatethatisdrawnv(b)=O 1
h b tfi1 lb d
•
Ifb is not a final state in the game then v(b) = \(b') ~here bis t e esl na odarf
. - b I , optionally unt1 t11e en o
!>late that can be ach 1c\ co 'ltartmg from ancI P a) mg
game
3. Choosing a rl'prc~cntation for target function:- .
Nm\ we ha\ e specified the ideal target function \, we mu~t choose .a representation
that the learn 111g program \\ dI u~c to describe the function Y that wtl I learn.
Vis the n.:pn:sentation of quadratic pol) nomial function of predefined board :ea_tures.
\Ve wish to piL-k expressi, e representation to allo~ representing an appropriation as
possible to get deal target function V.
V will be calculated as linear comb111ation of board features
:x. 1: number of blad, pieces on th<.! board
x2 : number of red pieces on the board
x., : number of black kings on the board
X 4 : number of red k111gs on the board
X 5 : number of black p1ec1.:s threatened by red
E= I (v(b)-V(b) J
l )
11,1111
1, \ (h)
L1_1ul
24
.Jt,M'\R/IJuly 2019
c'BCS
Se\ cral algorid~ms a'.·e known for finding weights of linear function that minimii.e f'.,.
one such a_lgorithm 1s least mean square (LMS) algorithm .
t.,MS algonthm:-
for each training e~ample (b, V(bt, 11
)
Use the current weights to calculate Y(b) for each weights w, update it as
W, ,- W, + ri(V~,~}-V (b))x, .
Where 11 is small constant example 0.1 that moderates the siLe of the weight update
rule.
5, The final design:-
The final design of checkers learning system can be naturally described by four
distinct program modules that represents the central components in many learning
systems.
Experiment
ne\\ problem
Generator
(initial game
board)
Performance Generalizes
system
Critic
25
M~Lear~
\ll l Seu i ( <,;,SI/fSI)
·
Oeten111ne 1y•pc of
training C"'-perience
( 1<\lllC.'.
,1g,11 n.',l
1-~::~ -- ----
~,
c,pcrb
lllOVC.'.
Linl!ar
runt:Lion of Si\
li:alltrl!.-..
i\rttlicial
Determine learning nl!utrnl
nch.\uri...
Grn<lil!nt
dt:l:.CCllt
26
cBl-S j (,{,t"I£/ I July 2 o l 9
~ -..:~~1111plc Sky
Air
llumhlit~
-
Enjoy
temp \\ind \\'ah•t· I• on·c~1st
-- ~I
I
,..,
~llllll) \\,11111 No1rnal Strong \\ HI Ill Same
sport
Yes
X -.. Sunn) \\:um l ligh Strong \\arm Same Yes
.) Raiuy Cold High No
Strung. \Vann Chang~
""x_,' l \Vann Warm
- -
X,
. ,. I
( Sunn). \\i.u Ill. No1
. I ligh Strong Cold
m,11. Strong, Warm, Same)
( "hangc Yes
28
• No,, the next instance is r .
, . ,
wntc •
c·
1
G 1. . , nebat,ve insta
s called as min· 1
c . .
•· • nee, ,or negative instance we have to
ima spec1ali · '
samp Ie zation that are consistent with negative
Now we instance is
s=== { Rainy. cold, high, strong w
[f d is a negatl\ . e sample • arm ' change,1
Remove from s an) hypotheses in . .
. . . . consistent with d
s111ce 1t 1s a negative sample consid . . ·
_ , er previous s value
s~-·S , - 1 sunnv.~ warm • 9· strong, ,.,a• rm, same 1 ·
G, === {sunn 1 ? ? ? ? ?J 1
l. ,varm ')
1" 9 'J 9 1
. .. .f
J')?'J'J')?I
t • • • • • • J
t 'J? ? ? ? same}
The next i: 1 qance is a positive instance
S= tsunny. \\arm, l11gh. strong. coo l, change l
S, = : sunn), \\arm.? strong, \\arm. same}
S-1 = {sunn), ,,arm.? strong.??}
Now to write G
Previous G~ = {sunny ? ? ? ? ? ?}
(? \\ arm ') ? ? ? J
I ') ') ') ') ')
t· • . . . same,I
Now to ,uite G~ = {sunny. ?????}
=P warm ? ? ? ?}
={??????}
G 1 ={<sunny?????><? warm ??? ?>J
S4 = { sunny. ,, arm, '? strong, ? ?}
Module -2
3. a. Construct decision tree for the following data using ID algorithm. ]
29
VII Se.n,, ( CSI(f.SI)
An~. S is a collection of IO examples of !,Orne boolean concept {yes or no) includmg 5-w
and 5 +-w samples
b1tropy <SJ -P Ing P - f' log I'
p Noof po~itvc instance
'f otal
nurnhcrof i11stc~
= NOwcalculatccntropyof(\ru~)
f
Entropy(S,.~) -( )iog, ( ~ )-(: }og, (;)
log( IJ
log, G) = log~ =-0:2x-2.32-0.8x 0.321
= 0.464 + 0.256
=0.72
30
~e,S .J~I J ~ ~Ul':J
~ t•ntropy 1
lJpdate valuesG equation ( l)
It.
-
\ ( htgh{I ♦-~ }
· \th nu.1l( 4-+ .ll J
1
-1,0-(h O
0-l) 0
Ctn in l "· \ ~) I-(~\,0.647-(-l
I 10
),o 10
I -{0.6)·, 0.G i- -0
-1-0.3 ~~~
0.61 IS
\., ,l i11 \ \. \ ) I. I 29
(1,\lll \ ~- \ .) 1.:3]
l1,1i1t lS, \ l) 0.611 ~
HiglH.'~t gain,, ill 01.· tin- ro0t mmh.·
No
/ ~\'t..•s No
/
Yes
Figur,, Tiu tledsi,m tree Ji,r the gfre11 tr11i11i11g ~,-,,,111 ,ies
32 ~ ''--~
, ztt etas r rt 7: ► • M'Htltf\ ., •
4, Explain
il•
. Ithe concept ot. cl . on
rcq uarct. to select att rabutes
. . ec1sion
t tr,ee learn·
.. . or buildino . Ing discuss t
j\ns, Dec1s1on
. I. I tree learnin,.
g IS a tnetl b ,\ decision 1 . he necessary me·asure
I ee using ID 3
111 \\ 11c 1 the learned t'unct10
. 10d· for approxi1 · algorithm ·
Learned. . trees can 'al so bc r is. represe
11
. nted bvnat111g
i discret
. e \ aluect ta , (08f Marks)
.
read ab I hty These . . ep, esented • a cec 1s i tre •
011 rget unctions.
. 5 1ea1 nm!!. as sets of 'f e.
~
I
algorithms
. • methods ar
c e amon r I then rules to .improve hu
1
Dec1s1on~ trees classify .instances b g t e most popul ar of .mductive t~an
noc,e, \,\ h ich prov 1•ct es the cl Ysorting
Iea f 'fi . th em down ti
spec1 es a test of some att 'b ass1fication of th . 1e tree from the root to some
c rt ute of ti . e mstance E I
ia no e correspond in t le instance d . ac 1 node in the tree
d
tiAn t •instance g o one of • ' an each b ·I 4
is classifi ·ct b . possible values fi 1 • r~nc 1 c1cscending from
'fi d . c ) starttng t I or t 11s attribute
spec, e b} tl11s node. then, . " a t le root node of the .. .
of the attribute in the ,. • novmg down the tree bra, 1 . tr_ee teSh'.\g the attribute
rooted
• at the new nodeg1, · en eKample. This process is1:1:e~~'.-'eespotndd,~g
pea e ,or tothethesubtree
value
to the attributes.
l nformat ion gain. Ga in (S.A) of an attributes A. is relati, e to a collection of example
S. is defined as
. , 15, I (s )
Gam (S. A):eentrop) (S)- ''"f.:.t ,)\SI Entrop} ,
. . .
, > fitf g the data, handling continuous data
1
b· Discuss the issues of a,•01ding oHr '" (08 Marks)
and missing values in decision trees.
33
.
Mct.ehtn,e,Le.CLY~
() ~ ...
{) ~
() ;.;;
o-
0 (,5 I
I
l) (l On trainin g data -
() 5.;; On tc:\t data
(} .;;
0 Io 20 JO 10 50 60 70 80 90 I 00
Fio,., overlittiuo
J' t:,
in decision tree /ear11i11g
11:rndling continuous data:-
8,. dd1n1ti0n of'IO .. it takes discrete set of values the target attributes whose value is
pred1dcd b, kMned tree must be discrete valued.
Altrubutcs tested in the decision nodes of the tree must al so be di screte valued.
This can be accomplished by dynamically defining ne\\ discrete valued attributes
that partilion the continuous attribute value into a discrete set of intervals.
For an attribute A is continuous valued the algorithm can dynamical!) create a nev.
boolean <1ttribute A that is true A<C and false otherwise.
Missing\ alues in decision tree:-
In some cases. the available data may be missing the values for some attributes.
For e:\arnples in medical domain in 'A-hich \H~ 'A-ish to predict patient outcome based
on \arious labs te~t~ it nm) be that the lab test blood test rc~ult i~ available only for
a sub~ct of the patients.
In ~uch ca~cs it is common to estimate the missing attributes value based on the other
examples for,\ hich this attribute has a known value.
A second more complex procedure is to assign a probability to each of the possible
value:-:. of A rather than simply assigning the most common, alue to A(x).
Modulc-3
5. a. Explain nrlificial neural network based on perception concept with diagram?
(06 !\'larks)
Ans. Pcrccptron :- One type of artificial neural network system is biased on a unit called
pcrccptron and is i Ilustrntcd in figure.
A pcrccptron takes a vcdor of real valued inputs cnkulates a linear contribution
of these inputc;. then outputs a I. if thl' result is gr('atL'r than sorn~ th r0 shold and -1
oth cI'\\ 1<;c
34
I 1111111 l111 1111 11 ' ,I
\
I-,
II
~ \\
I
,
I
I If
l·i,:t11t',' l',•n·,·111to11
Wi: will :-.,11111.: 111111:i, ,\111 c IH' l ~l. 1111 ,' 111 111 Ill 111111 I\",
() (X) ~{~II ( \\ , ~ )
ti \ ()
( llhl'I \\ IW
I c:11, 1111g :i pc, ccpl II JI I meh111 i11 g ch1>11,i11g 1:, luc , 1111 weight , W,. , W,
I hc1d J1 c II«: , p,,cc 11 " I c,uul 111111c h) p111hc ,c , c1111 ,idc,cd i11 pc,ccpl, v11 lc:1111 ini; ,~
I
the ~ct vi ,ill p11~'i tl 1 lc ,cn l \ ,d11cd wc1glt1 \ C1;t, 11 ,
11 { \\ / \\ I{ ( I I)}
h, Wh:it is i:r:uli,•nt ,lcsi•cnl and 1il'itu n1lc'! Why ,t:itistil' :ippro~i,u:,tion to
~r:uli,•nt dcs,·cnt i, 11cc1icd, (04 M:,rl~•)
Ans. c;nutil'nt ,ksccnt rule:- 1.nch 1, ,,ining c~:11npk i•, a pai, 111 1hc li11111 ( >.I) whc1c x
is Iill' \ eelIll , , f iII P" I \ I,I UC~ ,111,I ii ,~ 1hc 1,111•cl 11111 pul v:, Inc. 11 is Ihe lc:u II iII!; ,:,le
(lkll
c:-.:1111pll':-
u ru k :-0.5I he
) deII:, 111 le is hcsl 1111dc"'' 11111 h) c1111, idc1i11g Ihe l,tsk 111 I, ain inii an
tlu csh11ldcd pc1L·cpl 11111 ,.c. a linc:11 1111 ii 1111 1d1irh 1hc ,,111p111 is givc11 h)
o(,) ,,.:\
I hus a liucar unit c1111 cs ponds 111 lirst st:,gc ul a pcrccpil<JII without 1hc tlue;hold.
I hm· :11 c pract ica I dillic11 ltics in applying g, ad icnl descent arc:
I, Cunl'crging to a lucal mini1num can sometimes be slow, it re4uires thousands of
gradient
~- Ir thesedcs~cnl steps and
arc n1ultiplc local minimal in the error surface then there is 110 guarantee
that the pro~l:du1c \\ ill lind glulntl lllinimulll.
One c,m1mu11 v:11-i.ition 011 gradient descent intended to overcome dilliculties arc
W, ~ W 111 (t-0) X
1
One w,~y to vicw thi(j stochastic gradient descent is to consider a distinct error
lunct1on l·i1 (W) defined for cnch indi\ 1dual training example is as follows
.) I ,
Ed ( ,, >2 (td -od )
Bel 1usc '' c an: t OibidennJ net,, t'rk "ith mult1ph: output \llllt r.llht·r th.m ~ingk
output umt us beforl'. ,, e begin b~ redefinmg f to ,um th<· trmrs ~,, l'f .lll the nc-t" l\l ~
output ullll"- " -- •
E{ \\ H~ ~ (t -o)
\\ here output 1' tht· s~ t <'f output ttnth m thl' net" or~ nnd tl nnd ol nn: tht· t 1rget nnd
oulp ll, nluc~ as,oc1atc-d "tth tht• k output unit nnd trnining e~nmplt.· ct
,s
Ihe lenming problrrn f.11. ct b\ b,ltk prop:tgm1on to st'nrch o lurot h) polht·~l'!\
space defined b) nll po\~1bll· "l'1ght ,nhu.•s for nll the unih rn the nc·t"or"
OR
6. Dl'rh l' the bnrk proplgnhon rule considrring thr output lnJ rr und truinmg ruk
It,
for outJlut unit ,Hight? (08 Mnrks)
Ans. Bnr~ propag tt n mlc b, c n 1derrng mtput la~ er training mle for output unu
,H:1ght \\t1ghl, "J' mfh . . .: the ncmork onl) through nct1, nt'tJ ~nn mfluente onl)
thruugh OJ I ht: cfi re ,, t in, ~c \:hil1n rule to ,, rite
61 SI 0
(1}
finct 60
rhl'tk1hntl\cs..£...(1, o) ,,1llbcOfornlll,utputun1Hil(.exccptY.henk J
6o
\h• therefore drop the summation over output units and simply set k•j
\\ hen ~ ou set k-j re,\ rite the above equation
&E,1 o I (
---- t -o )~
&o &o J 2
5 I I 5 ~
=-l -(t -0 )=>--(t -0 ).
80 2 ~6o
l o
=~>- 2( t -o )~(t -o)
37
VII Sem, ( CSI/ESI)
:~d l
=-(tJ -o,) (2)
=-{t -o )o (t-o)
1
{4)
Combining this" ith equation
d w = -'1 61:.d
JI ow JI
AW, 1 = Tl ( t 1 - o,) o 1
( I- o 1
)
38
. . Jt<-♦'1.~ / Jt..,<,Ly 20 I 9
-t,'-'S
(., \\ hat b squashing fu~ction 3 "b) i, it needed? (0~ i.\.l.tr~,i
1
b, \ squa:::.hing function b e~~enttall) defined as a fun-.tion th:tt , qu . . ,h ..·, th.: 11 P t t~'
\It'· of the end" of a ,mall mtef\ al
ol n~eural net\'- ork5, the-..e can be lb ... d at node, m the hidden r ' .. r h.J ,qua, th . . . t 1put
n• . f
ll .,er\ e nn important role m neural net,\ or~ there an.· ,e\ en ,..i .1,htn,; un . . no '
i-,t out ~rnd t.>xph1in in briefl~ rt>prcsentation P°'"er of fet.·•d fonHl rd nd,,"Orik, "?
c. L (04 ~ l nrks)
hese qu 1te gt.>ncral re,ult:::, are 1'.110\\ n for the r~p ... "''" 'tatiun pO'-\ 1;.•r of fr.:d fol'\\ .:ird
J\11"'· 1
net\\ork
I. Boolean function:- E\ er1 brn)lean function ~an bt· repre,._•ntt>d t':\.ndl~ b~ ,omt'
t,,
net\' ork ,, ith o la) er-, of unit, although the numbt·r of h idd-:-r' vn ir.. n'qu1red gm"'
cxponr.:ntiall: in the "or:::.t :m: ,, ith lhe numben~r net\, ark mp .. :, .
Con:-,iti,•r the foll0\\ ing. gent:ral -:cheml..' for rcp1 t>,~ .,ting an arl,i: .: , ~0olean f'~mctto 1
for each po::,~1v'.: intJllt \ e~tor 1.:rcak n di~tinct hh.iden unit dl'l~ "-I.'~ ·, \\ eigh., ,.,, th~it
it acti, ate::, if and onl~ u~ ,!:;, spt·cific , cctor b input to the 11-..'t\, v, 1'., ulb pr'-"'n -. ,_.... a
hidden la~e, that ,,ill ~•\,n,, ha\e \. ...,·th om: \llltt 'lC~:,e.
2. Continuous function,;- fa Cr) boumh:d l."011tinu 'l . .... 1 ncti("'1' c~n bt· apprO:\.lllH\t .._'..i
,, ith arbilrarih. ,mall 1.. .. v, o,- a net,\ orl-- \\ ith t\\ o 1.1,., '-, ~ of ur ·, , It' tht"O ...,•m ' '\ th i,
~ase applil..', to th..'t\\ork::, that lht· ,1~mo1d unit, .n hidlh.·n l ·"- •'""' lim·ar m· ., : th'-·
output la) er.
3. Arbitr.lry function-.:- An) function can tx.· npproximnted h-1 .1rbitraf) n.:crn~h.·~ b~ a
net,, ork ,, ith three la~ ers of unit, the output la~ '-'r lbc':-i lin1?nr unit--.. the t\\ l"' hidd . .·n l.l, e~
use sigmoid unib and lht: number of unih required ,ll e.1ch l,l) t·r i-: fh."'t ~ '\."'\\ n in g ...~ ' . .'. Jl
:\lodulc -4
7. n. [\plain ma:\.imum a po,tcrim (\ I \P ) h) polhl''l'' u,m!! Bn~ l'' lhl'vn.·1u.
(06 ~lark.,)
Ans. Rekr 7 (a) quc~tion Dec ~O IS Jan 2019
b. Estimate conditional f>robabilitit·s of l'1td1 altrihntl·~ \'colour. kCJs, ht•i,,ht :-.
smelly} for the spccit..•s classl·s: {i\1.11} usin~ the t.lat~, ~hen in ti\\.' tnbll' u~ing
~ .
tlu~sc probabilities t•stim;ttc tltt' probability, alucs for thl' nt•,, i11sti1n~l' (colo 1:_
green. kegs= 2. hcight= tall and ~mclly=no) ( 10 :\h\r~)
No Colour Ll·gs lkight Smdl) Spl'dl•~ I
39
~n~. (( olPt fl~l'II k '. 1 lu 1 •ht till 111(1 ,111 lh 1101 1
t hll , ,..,~ '"' In pn:d1~1 lhl' 111~• 1 , du I ,11 ,, Ii I pl tht 011 q l p, ll d
I 11µrt, 11111,; \ ,, ,.., ~•" c11 h,
V II lll-1,111,1\ p( \I) ( p( 1 \I) I
,qM Ill
mgt11 1~ Pl' I)
, I\ t\U I l
P(~ll,lll fll.'l'll ,j)p(k~s ...,/,j)p{h1:irht ttll)p{'-llll.'II\ 1111,1) (I)
I he pwli.1htl1t1'-'" ul lltlll.!icnt 1,ur1.:1 , ulucs 1,;,111 c,,..,tl) Ii..: c ,t1111,1lc b,,..,cd on lh..:1r
hl'qlhJlll.'11.·, P\ 1.·1the X 11 .1i11111g c11;11111pk~
P(Spl'CI\.'~ d,IS!-.C', M) 1/8 0.5
p(:-ipcd'-'" d,,..,..,ct; I I} ,1;x o,.i;
Si111il111 I), \\C c.111 c!-.tim.,tc the c1111ditiP1111I pll1l>,1hilit11.!c, lot cxnmplc those for
l.p(coh,1 ,,l11tclspccic<.d,1,s1.·s 111) 2/1 05
p(cohu ,,l11tc spcc11.·s 11)1/1 075
?
P(Clllll1 giccn ~pc~i'-·~ 111) - 0.5
l
1
p(l.'l1lo1 gu:cn/spc~ics II) 0.2"
I
"
2. P(kgs 3 spl'CCIC.., 111), 0.75
l
(I
p( legs ) ~pl'CICS II) u
0
1
p( legs s/spccicsm) 0.2"
4
4
p( legs 2 / species h)
4
3.hcight
40
· ,.... . It<
r~ i~' ♦
________________________
J td=)I 2019
H' / _
~,ell)
"'~
pl ,111d h \ cs spc~1cs
~
Ill) 0 75
4
8. ~,. E:\plain Nah t• lb~ es d,1',ilil'"- and Ba) sdan hl'lit'f ndworks ( l O l\larks)
Ans. Nah t• Ba~ c.., dn,sifit•s
rhl' Nni, c Bn) cs cl.,.-,~1hc~ applies to tht.' le,u ning. tas!... ,, hcrL' each instance :\. is
dcsc , ibcd b) t1 conJunction of attnbutc, nhtC'~ ,111d "here the t,,rgct function f(.~) can
t.11-.l' on nn) , nlue from ome finite set \ .
A ""-'t uf trnining examples of the tn,gct function is pro, tlkd. and a new instance is
prC",1..'ntcd. described b) the Lr 1plc ol ,ttlr ibutes , aim: l Q . Q .. Q)
I hl' karner i, asked to pr~dict thl' l.H'gl'l, ahtl' or cla::-.::-.iti~ation for the nc"' instance.
I h1..• H.,:, "-·~inn nppro.ich to l'las5i f} 111g the nc" im,l,H1~1..' i, as..,1g.n tin: most probable
t.u-~1..·t, .tine\ • gi\ en the :iltl ihttll', ,1lucs lt..\. t.)., .... 0)
\ ,. "' - argm;;.. P( \ n n .......1
1 1• 0 )
\ \
P(\')
•
is estimakd b,• ~ounting
...
the frequency with which each target value V J occurs
111 the trashing data.
41
\\ ih.'l'\.' \ 'l lklh'h.'' tilt' l,lrft'( \ ,llllL' l'lllpllt l)~ t Ilt' \ GI\ t ' f3 •.l\ t"S, 1.·1:-\,,ttk~
• ' -
8!.n t.'sian Bdid' ~ L'tn nrk
\ B:n t':-t,lll l~d .t'f \1.'I\\ l)r"- lk~l·r 1b1.•s 1hc prl,babi lit> dt'-ll 1bu t i'-'Il g,.)\ t>rning. n set of
\ ari.1t,\.•:- b: ~Pt'l·,t~ ing .1 M.'t 1.'f 1.·1.mdtttl,n.ll indt'fk't11.knc1.' ,1:-.~utnptlL-'O, ,lk)nt! '' 1th n
St'{ L'r 1.'lmdHi1.,n,1! rt\)b:tbiltttt'S.
In ~1.'lh.'r.1I. ,l H,t,1.•, 1,111 b1..-lil't' l1L'l\Hlrh. tksl...'ribL'" thL' pt,.'babilit: di-..tnbuti0n 1..'\t'r a
St't ~l, f \ ,II ial- k·, ~l '11~ 11..i1.'I ,111 ,lrb It r,lr) ~1.•t '-' r I ,rndom \ :1 rtab k_,..., ) • .. ) \\ here l'3Ch
1
/P (~ l).1)=P( \. l1.)/
\\ e Su) thnt ~l..'t or \ ariabks \. I ..... \ is C()nditi1..ln,\ll) lfHkpl'llLknt l'r the Sl'{ of
, arinbks •, 1 •••• •, n '-L!i\ en the ~ct (,f\ :-inabll's / •••••• 1..n if
1
p,\ :\, ...... ;\, I •\ I .... •\ m • , , . . . . . l n ) - P(:\ , ...... :\., . zI ...... z11 )
The nni, e Bn) es dnssific, n,sumes thnt the instance nttribute A is conditionnll)
indt'pt>nLfrnt t'f instam'l' attributl's ·\: gi\ en tht: target , alue \ '. 1
The ,wi, l' 8) t'S clas~ifies to cnkulnte P(1\. r\ I V) as follo,,er
P( r\. ,,.\ \') - P(.\. 1
\V) P(,\ , \') "' P( t\ , Y) P(A , \')
• Repn·sentalion :- Ba) c,ian bdid' 11c·l\,or1' rcpr,·sc·nts the joint probab,lit)
distrilmtit)ll for n set t)f \ ariablt·s.
• For E, :- Tht: Ba: l'sian nctwor~ in th~ figure represents joint pwbabilit)
distribution o, er the Boolean \ anables storm. lightning. thunder. forest fire.
campfire and Bus tour group.
42
-
Forest Fire
In general n Ba, es·1a11 Fig A Bayes·iu11 Be/i,,ifN
•, • • ~' net\, k " etwor/.i
spc~if) mg a set or ~ond1t 1011 u~ represents the 1oint .. .
conditional probnbil't' 11
• 11 1tkpendencc ~ssu· . probability distribution b,
N~t,, ork arcs r~1~1·" I H>,I. ' . mpt1ons together,, ith -,et of loc;I
· \.~l'IH t \I..' a ·
'ts t '~:-.cniun th·tt ti ·
I non l c~cendnnt.... in the 11"l .1 • ' 1e, anabk is cunditionnll . d
\V X · 1.: ,,01 I\
0
1, • · · ' in ependent of
. c Srt) ' i:s n descendant of y is th~ . _i.:_n _its ~n1mediatc pre deccsso;· in the net\, k
Second. a conditional ()rol b·1· t..:1c is ,1 d1rakd path from y to X or .
tl b b·1· ' )a 1 ,t, tnble i '
1c pro a I It) distribution for tirnt ·, bsl gl\_cn for each ,ariabl_e, describing
11
)redcc\.!ssor
l• • • ~-
'ai • e !!.I\ en the , "I
'"'
f .
t, ues O its immediate
.
1he J0111t probabilit, for rm, d . I .
., ( cs,ret U~Sll!.nm ' t r I
ncl\, l\tl , ariable () ). . . . ll1 ll 'a ue~ (~ .... ~.) to the tuple of
• • •) \:Un be compuh:d b~ tht· lormula.
P(> 1.. ,... y) TCP{) parent5(~))
\\ hl'rL' parent~
•
h ) denotes ti • . ,~· -
•'
·
H: set o imnH.:dmtc prt:d~ccssor::, of v . ti • k
• I,,.,
""' 1·11 11 1g }>Jaycs1a11
· I)>l' 1,et
- •network ·1m 1c net\, or •
l__ir~t. th~ lll'~\\.ork ~t1 ucturt might b1..· gi, L'll in ad\at1L'e, or it might lune to be infi rr i
liom thl· tram111!2. data. e ec
:L'~on1.L all thl' ... nd,_, ork , ariabk:-> might bt: din~ctl~ obsL'n able in each training
1.:\,1tnpk-. l11' ~Orne m1ght bL' unobsL'n abk
• lnforcncc
\\ L' \\ i~h to thL' a Ba: c~ian net\\ ork to infer the value of some target variable given
th~ obst'n ~d , alm~s of the other, ariables.
This inference step can be straight fon, ard if, alues for all of the other variables in
the net\\ 011 are kno,, n ~\.act I~.
h. Prove that how maximum liklih~od (Bayesian learning) ca~ be used in any
learning algorithms tha tare used to minimize the squared error between actual
output hypothesis and predicted output hypothesis. (06 Marks)
43
\ l l ,, o t (t , I t ,t>
r\.tl"i lh" 111. h"'u '" I' t,1 h . h I,,, l''l'lttl;!l11, d 11 "' \H ''-"'i.: m 1'1mutn likl1h
h, p,,,h, I "' lllllllllll \: '''" "'" 11\:d l:11 11 1
",, II I\ I\ p(I) h)
I
l11\\'111h.1l lh(; 1H11\l: 11lin,, 11101111.11 d1 t11l•11l1t 111 ,,,th ,en.> md unkiHn,n' mince
1.:
o , "'-'~h d1 11n,..,1 1h,11111,l.:, , 111111 11 ,il d1\111b11t1P11 "1th' 11 1,mcc o l:Clltcrcd 1round the
1n1c l 11~c1, nhtl.' tl,) 111thc1 th.1111l·1,,
I h"·11.,rn1c l'(d h} ~ 1~1 "'-' " 1 ith.:n .is I llllllll ,I d, . . t, 1hut1011 "1th, 1r1 lncc o nnd mean
JI th)
JI n:\) h{\) llll'II th\· 11111111 ii d1,111l111111111 IP1 the ~qu,,tlllll I\ ['I\Cll h)
II I I I II I I
,II gtll,I\ 7t ✓ C
' " ' ") no
I I ( ,I I(~ ))
,II ~111,1\ 7t ✓ C
I II I I 27t<J
44
9. a. Explain locally we· h Modu~I;e~-~5~-----------
r
~ ~
1g tcd
,1.ns. Let
. . us con,ider
. the case of locmear regressmn.
.
f( approxunated
) near x us111g aIII'Yweighted .
,egress,. · . (08 Man"'),,,
x "Q + w, a,(x) + :' ... + a mear function of ti1o,~ ,n which the target runction f
As before a (x) denot . wnan(x) e orm.
. • es tie1 val
. . ti ue of the jth att n'b ute of th ·
1e weights that m·i r1tm1ze
examples
Tl I ( , le squared error summed• over instance x. D of training
the set
Where
rom . (i.e. letarnmg
11 is a constant
. M'the. notation
. , ~
0 t( , d ~~
.c )mt"'- and where the training rule has been re ex
pressed
~
l\X
1
fi ) m1m1ze the sqltar·ed error 'over · tx,h::!1 x-' aJ (x))
l, ( ) JllS t e K neart-st neighbors
(l 2
1 entire
over tie 0
(2)
we1g
. Minimize
I .
1t111g the the squared
error of eaclierror
t. • . . set D f training
. .
examples' while
.
distance form X . iain1ng exampl e bY some decreasing
. function K of its
~ ~ (r~~.~!~,~))' K (d(x, , ))
I
E, (x.,) =
• l>clavcd
several rcw:trd
imporwnt :· 1 he wsk of the agent is to learn a target function II that maps
respects.
trom.1hc current ,tatc and w the optimal adio11 a~ n(s). In rdnforcen1ent learning
45
Vll ~\ct11 t ( ·s l/l SI)
·
tr ,1111111~ , · , . ' hhlc the tra11· 1t:. , r provides
111 lnr 111:it 1011 1s nnt .1, •11 •
onl\- a sequence of
•• of actions
. ': I l , ·cutes sequence .. ..
1111111cd1,ltl' H.' \\,lld ,.ilUt..' s c1~ t 1L' agcn c\.e · , . fl •nee~ the distribution f
• I. I ·
•.xp orahon :- In rl'1nton:cmcn l:,
· · t I •·rn1I11~ agent 111 lit:
.., _•
o
Tl · raises the question f
tr ainin° C\.,lltlpk-, LJ\ the ad1on scquern.:c it chooses . 115 . · 0
t"' • t cm.:ct1\. e 1earn mg.
"hidi 1..·,pcri1111..·ntation stratcg) prn<luccs mos . t to assume that the ag
• P.u·tialh obs<.·n abk sf ates:- \I though ti is com enien ' · ·I ·. , c~t
·1s ,cns,1r-.. · can pcr~e,,. l' the cnt1n: . state, o f ti lt:• c, 11 , ironment . ti at eac . 1 tnnt.: step 10
•
· · · d . h partial 111 ormatron. 1· or ex :. A
111.111, pr,1~t1~.ll sItuatI011~ <ic11so1 pw, 1 cs on· . l • ·t · ·I .
· · • , .
rnb,,t ,, 1th a t(,r\\ ard p0111t rng camera can no c t 5 ·e ,vhat 1s
· Je 111nc 1. t tn sue 1 cases. rt
m;n lK' lll'\..'Css,1n lor - the a~cnt to consr·d er . ·its pre'\. iou s observations . .... 11er \\ 1th
tot!et
· • .... • ·
its "-'lltTl..'tlt sc11s0r data" hen choor.;111g action:,, ant t H.: f f , best pof ,cv J
mav
• -
be one th at
.
c I10sc-, .IL'lt1..)11s ~pee .rhea
, 11 ) to 1mpn1,
. c ti ic, o bs•·r·,. "' c,. . bilit,• of the • cn\'1ronment.
.
• l ifl, - long lcurning :- Unlike isolated function approximatlo~ t~sks, robot
· 1..) 1·ten n:qu,re~
I1..·arn111g · t Iiat t Iw ro l10 t IcaI •n sc, ,,ral -.. r•·lated
.. tasks withm the same
t'll\ iro111111.:nt using the same sensors.
ror 1..'\. ·- a mobil~ robot mm need lo learn ho,\ to dock on its barter:· charger.
lw\\ t1..) 11,n i~;ltc throu~h
~ .... nar;.o\\ corridors. and how to pick up output from laser
printl.'rs .
OR
I 0. n. \\'h~•t is instance based learning'! Expluin K-ncarest neighbor algorithm
(08 Mar~)
Ans. lnsr.111~~ ba~cd learning methods simply store the training examples. Generalizing
be~ ()lld these examples is postponed until a nc\\ instance must be classified.
Each time a nc\\ que1) instance is encountered its relationship to the previously
stored examples is examined in order to assign a target function value to the new
instance.
K - nearest neighbor algorithm
The most basic instance based method is
K - nearest neighbor algorithm
This afg 0 rirhm assumes all instances correspond to points in the n _ dimensional
sp,u-c K 11
46
ln tlh' lh'a rcs\ 1w1ghhw k,u ni,w ti , t· , ~ .
c \\.: ,ltg\::t l\lnct1,,n m,n he either discrete , alucd or
I t
' ,,., I \ l lll-'\ '
1lh' " '~.H '--'"t 1\1..·i c.hb\)\' ,\I l\)l'I\\ 1· . . .
, ~ µ in, l°'t •'Pl''1..''-'lllat111g a d1,1..· 1cl1..' , .th '-'.d targd function
, , ' '-'" ' l)t' \' \\
f h HlllH1-! atµ.,\ , lthm
•• l\)r• ,1..' ,h:h• tt.1min~ ...
1.' '\.,un,,1,, ) )) ,\\.,
1.: , " · 1, "
ii tilt' C'\.,ltnpk· to th1..· I.1~t tram . .mg cxamplos
( ' '""s1th'a t w n nl!!onth1n
• '-. '.._, .- ' 1'~1'\ t1bt,m ...·1..· \ ~h.1 be ~l.ts:-- ith~d
•
•
Pig K 11et1rt!.\t nt'igltbor
\ ' l'l \lr 1'1..', it i, l' ,\lld 1\ 1,.'p.,ll l\ l'
m s l,l11CC .U-1..' sho\\ n along. " ith X. •
l h1.' 1'. r11..'.m.·,t nc ,ghhi.'t ,llg,m ithm for l'ontinuous, alu~d target function.
ls.
}:f ( x..)
f(, ) < _.!,. )_ _
"' k
b. Fxph1in s:unph.• l'ITOI'. true error contidcncl' intern1l and Q-learning functions?
(08 Marks)
Ans. Samph.• error :- .-\ sample l'lTOr denoted as errors (h) of ah) pothesis h \\ ith respect
h) t.ug1.·t fun1.·t il,n f and data sample S is
\\ IH:n.: n i~ th\.' numbn of example in S. and the quantit)' o(f(x). h(x)) is l if f(x) ::j:.
h(:\. ) and O i..1tl11..· n, isc .
Trm,• l'tTor :- rrnc crn.lr is denoted as error (h) of hypoth~sis h wrt target function
f and db tribution D is the probability that h will mis-classify an instance ·d rown at
47