Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

17CS3074 DEEPLEARNING

Datc of the Session:30 LLLR Time of the Sesion:

LAB-5:Classification of MNIST using ANN

Program Title: Understanding and implementing the logic behind the mult1 class
classification using soft max activation

Prelab:

1) What is difference between binary classification and multi class classification?

inab y caufrakiens Oe Heose taks ahese eromple ore ostlined erc h


QMe cf tco (lacae Muli rlact clautithiatren is hoie doet tuhene Yrarpleg

be audqned ecacky one cf moxe lum cloe.

2)Bricfly explain about softmax activation function?

So/tmax a mathemattal tavntton ihaf (vets o vrclo c nurnberi Tne o


veckox tt polabil? tre, whne -the wcba bstla of eoch velue Ov prepor biona

o the selakve Stale of tack valut in he veto Eorh valu n the cuhut
Sofmax funcbion 15 ner prcrd a he prcbobily of
in the ouhput of the
mem besshp ra tach clas.

3) Differcnce between softmax and sigmoid activation function.


Sstmax is sed to multi- claisihtaion n 7he gishit Regresten model, uhnral

Siqmeid is ussd los binay dlasi huaho in -he loqtshit tgentn modd
TS similaY fo the simoid

27
17CS3074 DEEPLEARNING

Inlab:

D Karthik is bored wifh using ANN for


binary elavsification.
Multi class classification on MNIST datasct using ANN.(Hint:So, he wanted
perfw to

Ue softmas activation
function for the output layer with 3-4 hidden layers
also evaluate the
consisting of Rel activation
function performance by using confusion matrin.)
Note: onc hot encoded mnist dataset is given in the form of csv file no ned to load if
from MNIST.

impst nunpy o p
impost pomdas as pd
pest atnletlo, typlet ou ph
mptdt Scaboan os tn
Aom 3kleasnsmodelselothien impor hain. ett splt
om stean. metarC inpea f unluftn_ vmatriy

fmpot ker as.

hain-pd-1 to d- riv (\ E:nijtvorn.rsv)


test 1ead (sv ('E:\Tmst tesf/su)
trou'n. drep (f'tab'3,9.vaue

l2sS-o
estx- test.voue
testv testx (2ss-o

K Xxeshape (-h19, 28)


test- test_x.xeshopt (-\, ?%,23,1)
to.Cofenorítal)
pvint ("LALd srygeg. «lon)
x-tain,X_Heat,y-teoin, y.tesf: train.1 «t.splt (X,g,4ot_se , To,nd
x-tvain xtain 3ehope (xfatm, thape (ol. 2s 2n
)
Hqyoris p subplats (Hiasige -(ce, tol)
fo 1,bx in enumfxa t c( 6xis. fA):
ax. tn sho(xtarn--{3 Coa : "binoy)
12CS3074 DILPLIAKNING

mecn st d:n man(.tra d to


d stonddie()
en (x.mess n) .
epoAs bach.

medel-Se qunbate)

n madd ( Cenv 2D(Htee (, kesne.tge(7,ty,tu

dAC co 2CAltes+Gu, kesnet.air(s,), nrtho'h1)

madd atch Novmattofion )

nndd Con2D (:lt*vos, kevnd si , ) , ochiinbion"e


mron dd(Cenvi (kl4es. 1s, kenel ,),octvkn du
m.d(taxfoclng(poeltige: (od))
ma dBafch Novma ltza br)
m add (Conv2) (:lten: 2s6, kernel sie (,D, ochako eh )

add(tMax foetng D(poel.ie:(a,)


mdd (Fltcq)
a d d (Bad ch No maliga4'onc)]

modd (Den e (S), acivati "aetu"))


Vmodd (Den Se Cro, octvativas Soffo "))

model compile (os: "tdegonial(1Citenfcry°Ykg td

meeies C'acura "


bar'n. gen- dadaqen. flow K. taa',y-tai'n, baih. Si'e bat h. S¢-

ge data qen , tlow(x.tent,y- test, bateh- sige*


1,ot k,
dest
tes-9n s
17CS3074 DEEPLEARNING

h1stry model. dil gent vakes( ésa to.qen,


epochs cpochs,
Stpt- pts "poh k. tarn . chope lol
Validahon doda: t est qe
(os
valtdahion. sleps xAest shope
(x_1est)
pcdmod paedict
est-- k. dest,erhope (yx_t est.shopr(os, 26,:
pei nt oamoX - Pred, t)
test, )
-test hPasgnm exr (q.
mat Confusion -matsikx(Y-test,-pre
n t (aCCuracSee (Y-tst, Y-pxed))
figoxs plt.4ulplotslui,tigsige(, t)
tlot)
fo, a in eoume yatos ( aris

ax tms k-4est---(r3, (mep: 'bina)


Sct Lthete Real auml,es s y t e s t [(7.a maYO)

Output:

30
EPLLARNING
17S3074 DE

Postlab:
is out the applicalions ot image classification in real world.
A tmete Jmoqe Ogant3hon. trcm leud Arps fo ktricns

)stockhekngno)k and vo kirhita

)Visual Search for iniptev d ndd dice vriakitt

sncqe Bnd ke Recoqnih'on on Socdo/AjckoerK¢

efnkesackie Narkehino and (teaklvc lomfoiq n

Comment ofthe Evaluator (if Any) Evaluator's Obseryation


Marks Secured out of

Full Nanme of the lEvaluator

Signattr of the Ev aluator Date of Eva!uaton

You might also like