0% found this document useful (0 votes)
7 views12 pages

Aiml Sol

Aiml solution

Uploaded by

Syna Murmu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views12 pages

Aiml Sol

Aiml solution

Uploaded by

Syna Murmu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

2Deig Linean A

lttoatin
Fornstps? which haig 8reptestntvaniabl
as: d tplan
hight thcaleulates dlape onvaniable depr
e b hetght intenepttndepndent
b each to
y, with the
O,
dentCpndictors). co
b Input, whneels0;
e Nynesstn4" (2). betn a
t t thu
porcaptthsileanyengeon 2-5(6)+30 m we vaniabte
) olp ket' 5 (the ywont
taleulate p initi anaytny
1
either mate
ort to dependent
It
else wughb prtedtet asums suitabe
3ith
: 42.5
0 %paat
o statstieal
t a
yugt vámiable
outputs 1. with datc
2-5%+ s
k chany person' mdatonihiplinean
two on (tanget) Marmple
me
0.value 30 thod
AND terahons. ,
hight
thun with
wdght and usc
haght)weight,and tegnsson
Linean
" one modu to
Tnuth Considen g vaniables
bt?
a and besed
gneatnthan person independent
mone
tat ()table the
cl ne
the
bast an on
pencepkon line thin
twigh).yncton
ith
o, ) b) a)
w, b w,
E-0+ 3lhput w,=05 lngut b
= =0-2 =05 W ylnput
05 o.2t
;(05() (,, o 0-5t (,, 04 0-5 o5
t
o.2(0-
+0-)o.2 +
o-2( O"2(0- o.2(0-1) t (a,,)
)(o.1) (o o-2(o-1)0 lo)
+ ) 0-1) +
) (0)ot 1) i)-
(o) (\,o) o2 olo)
(1) (o) (o,
() +
o) 02 o.y) o)

6) a) \tratton2: b w, ) b
0-2(0-i)0t
b= =-0:2
8o5 nput =05
Input 0 i Input 0+
D5
-02
(,,) 0.2
0-5 (x, + (a,,
(o) (o) + (0-)
02(|- 02(-
+ )= ,)
o +
(1)+ (o, (o) (o, bzo 0,
1) ot o) 0) o) ()
(o 1
o)
2)D

d) trtt+) b-0-2= ,
b
lnput
9 tnput&} deetoto-eH
l8nput -02
-o-2 *}lo-3) 0+ 05
tot)+ott)+t + o.2 +
( t0:2( o.5l1) (, 02(o-
o-2lo
(0-
aa)- + 3)
b-1) -0) 0)(-0.2)
o)(o.2)
(l,1) o(o) (,o) =
+
(-o-2))

E A ihe
Py|)> I,5 mag two
untbased à A bnay madu to
a emanples Tknahibru
bepencaptnon
tostum bank vantable pnedtt st o
b
ame (pana a needd
went depen
ha mts stais Additnath
wtlt pmobabilibieo rdependnt
dnt
bleed pn do
to ane t ea tant
de7aultpnedt leannd
ndeendent
tanametn method
and +5) , g coneyaTtnats das
that aiabts
vaniabe
on
laun wh jom ws
loan a the
then l
dat (ojg. ard
a)
wlth nihad seeda ) Object 3:
penfonn k -meanA
cduakny
Drstanee to (4, 6):
(12, 4) lle the steps
dusten
Y- co0ndnat 4
Distance to (12,4)
2

3 d) Ogeet 4:
Dstanc to (4,6):
S36+ 4 -(40
J(4-1o) +(G-4)?
12 cdus 2
Distance to (12,4):
Initial seeds ( centoida
(4,6) e) Objet 5
Cust 2: (i2, 4) Dstane to (4, 4):

each sbject the cdoNeat duatn (based on Eueiden Asgnd


cdustn 2
distance). Distance to (12, 4):
J02-12) 4(4-4)2
tucltdean Dstance fonmul:
Sttp 2 Updat the centnodo by calutety the men o the coondnats

Calcuate distanee pn both centnoido: Objeets q3ignd to dusten i:


a) objeet 1: 2+ 4 t6 =4 -'4t 6+ = 6
.3
istance to (4,6J:
dustu 2:
J(4-2)? (6-4 = 4 t4 =Ss
dushen 1
Distanee b (n, uj: 2 2

Check n convyn
b) et 2: a) Obect 1:
distane .ko, (4,4) : Drstanee to (46):
J(4-4) +(<-c)? =o (4-2) + (6- 4y2 Jaty
clushn'1
SS Assigned to
Distane to. (12, 4):
Dtanee to (14, 4): clustun 1
JS
Ji24) +(4- 6)
b) Dbject 2: The entrioi da didn't horye a n the knat on
th 1St tenatton, the
Distanu b (4,6) Stnce, the centnoica are

And dgonithn haa convnged.


Dhtonee to (t1, 4: 5 The mojt cocnmoy inan nentaion
modl Mean Squane Ernon (MIE). It rneasuns the avs squened
dilerene beth th achual (obsenved) valus and the pnediced .valus.

) Object 3: The goal is o miotntse thin duniy tran


Drtanee to MSE (á
Distane (t, ):
where n n. data points (sampiu)
Tth deta point
i actual (tnue) velue om the
or th Th data potnt
the digenwe Btn the atuel
d) objee 4: The bnmule calculats the q:
Datane b (9,4): vae Cy:) ant the pinedikd valut ) en ach date pånt

Aitjned to
Drstance o (11, 4): cdustn 2 Psints A(3,1), B(4,6), c(s.s), D(<,4), ¬(%,3), F(«. 2),
Jln- io) (4-) JI +o | G(4,2), H(8,4)
Eps 2-5 (the nadis oh thu naghbonhaod ean en)
e) Objeet 5: Min Pts 3 (min. no. of poinb n the nigibounhond to be Constdd
Drston u to (4,6): potnt)
Step 1 : Caleulatk the' Btt Eudtan dittanee bet" h pin oh points to
Dstance to (i1, 4): duste 2 identM nuzhbouns othin the eostlon radBus (Eps):
(- 2)2+ (4-4) : JT:= I
custen 1:
a) A (3, ):
Disi. to
2 +4t 4 = 4
3 Drst to Negtboura Eps 2.5 ) 'B
Drst bo D: 4. 24 A cOne potnts (as MinPt 3)
Obj asigned to duster 2: Dit to E: 5. C5
4t4 =4 Dist to F!5. 83'
2

Dist H: 583
b) l4 ,6): )F(6.2)
Dtst. Ao A: 5. 83
Dist to A(3,) : ):41 Nughbounu ithin tp 25;
Dit 4.44
Dryt. to c(5,5): 41 D, E, 9
Dist. bo D(6,s): 2.82 oithin tps 2.5;, point

Dit b E3): 4i24


B aone pont ( as Min Pt 3)
Drst to (6, 2): 4.47
Dist to (2): 5 Dist. to 2. 82
Dit- to ($,4): 4.44
a) (7,2):
sithi
) * c(5.5)
D, E, F, H
Drst o Nlghboung within Eps 9.5 core point
Dst 2.23.

Dnt t ¬ :2-82 ot Drst. to


ore -potnt ( ao Minpb 3).

Dist st, t t: 2.23


Drst- to t: 3.i6 h) tlS,4):
d) D(6, 4)
Neshbouna ithin tps 2.5;
Dot: to A: 424
withtn i tps = 2.5 D, E, G
Dist to
Dist, b , : 2 cone point
Drst. to C: |. 41
D a cone poiot
DrskfoF 2.82
Dit to 42.23
Dist o q: 2.23
Dt. to tt: 2 (ORE POINIS : D, E, , 4,H
DUTLIERS: A, ,C
e) E(1, 3):
DisA o. A: 565
wIthin Eps 25)
gbuns
Dist: to C: 2. 82 D, F,G
Dst bo E a
point
Dist to F: 2
1toation 1:
Input Dist Neanst
layn Output Point Dist. to Dist: to
C3(8,4)
clust

lagen Ci2, 10) C2l2,5)


Multt- lan A1 (2,18)
843 C

Pereeptnon
(ML) 6.08 C2
A2(2,5) 5
C3
A3 8,4) 608
OPERATloN: 424 5
A4(5,8) 3.60
a) FORhARO PROPAGA1ON: Input ani att multlied by whts , biass ,ene
added, and actvains each sthot 5
ane A5(5)
lay 4.12
C3
4:21

b) Loss CALCUTAT1ON) The model compane pnedicked outputs to átial' valus t.28 C2
A( l, 2) 6.06
wty a loss . (MSE)
As( 4,9) 2.23 4.47
) BACK PROPAQAT lOAN: The madul adjuot wyht ond blages ba pmopyaiy
bakand
Centroi da
Step 2 Updete
d) 1TERATION: This pnoess Hepeats aenos multiple epochs unki- h a) Custn 1:
minmid and Hhe model leanna Kkeetiveg
M, = 2+ 5 +4 = 3i61

An MpL a
Centnoid 1 : 36t, )
yncasion tasks, ett,
POrNTS: A(2, to) A2 (2,5), A3 (87 4) A4l5/8) , As(75), b) Custon 2:
2t | = 5 5 + 2 = 3.5
A6l6, 4), All,2), 2
2

Let elusten 1: A1 (2, 1o) Centoid 2 (. 5, 3. 5)


lusten 2: A2 | 2,5)
c) ustn.3:
custe 3: A3 (6,4) 4:33
a3 4 5+4
3

Skp 1: Asstgn points to ncanut (antnoid wst Guclidean distan


Centoid 3 = (45 4.33)
Stp3Reessign points to neaneot cetnoid ftoal custens
a) Cstor 1 AL, A4 A8
Points o C2 Neanes t b) Uustu 2: A2, A7
cluster
(3.67, ) (|.6)3.5) (, 4.33)
c) Austen 3
A3, AT A
Input
A1(2, to) |.94 651 q55 (nput
Sumnaton
A2(2,5) Output
5.04
A3\8,4) 6.61 G51 .o5 C3 Ackvatton
Auls,s) 54 4 14
As(4, 5) 5.20 5. 4
3
AG(6,4) 5.51 4i52 Bias
c3
All,2) i 58
Sirgle layen Poneptnon (sLP)
Asl4,4) O.33
555 C OPERATiON:

a) Custen 1! a) lnput: Paovtde le valus

, = 2 + 5+ 4 = 3. 67 6) waght maltplicaton :' Multtply ach e with nupeui ve' daght


2 c) Sumenation Add the weishtd lps and bias to get y u n Z +5
Centmold 1 = (3 6, 2)
b) Cuustn 2. d) Actvoaton: Appy thu

2
j22 5t2 35
2

Cent noi d 2 (.5, 3-5) ) Output: he pencephion produees binany casi jteton Mesult

J3 4+54 4
hek (a) 2 3
2.6 3.2 2-8
Centnold Y (4 4i33)
Sals (y) |2

Stp 4 : Check Fonmula uncan Regnession:


n conveyene
The eluchn acstgnments &ne
unchanged iom the pnerious tenation. straght ine i:
achivd. Convemgeace
m
slape o lne Sales or week :
04G(4)4 0-94 416

Saes or wek i2:


Calculal-in th mean and

Clusten 1: ( , )
5
Clustur 2: (5,)
tuidean distane:
the distane bet dustos ond potnh usty
Calculating
et Calclatiy the slope (m: Cuustn
Dist to Dist: to
Potnts neaer
cil1, 1) C2( 5)A)
m
I(- 2) Cy-g) (reconds)
421
R (I,)
m= (-3)(1.2- 2.32) +(2-3)(18 - 2-3) +(3-3)(2-6 - 2.32) + (4-3) 6.10
R2 (15,2)
(3.2 -2-92)
+ (5-3) (2-8- 2-232) R3 (3, 4) 3-G 3.6

(t-3)2+ (2 -3) + (3-3)+ (4-)? + (5-3)* Ry (5,9) 72| C2

Rs (3:5,5) 2-5

R& (4:5,5) 5.31 2.06 C2

Ra (3+5,45) 4.30 2.91 C2

Calouletiy inkncup) (el: Points asslqned to dustr 1 :


(-25
+|·59

>C: 2.32- (0-u6 X3)


Points asstgne to duston 2:
4, # t5 t 5 + 4 5t4
=S35

Centoid 1: tt+3) l-25,1-5)


Recaleul at the ditance points and

Potnts Dist t
(Recoras)
Dist to. Nean wt
clust
Caleulety mean

40 +120+ 150+100+ 130


4 2 i18
C2(t5f) 5

t 055
Caleulaig rneen

R2(1-5,2) o55 3.92 y= l000 + (3004 1800+ (200+ 1380 = 1336

R3( 3, 4) +4 42 C2
Cateutakig the slope (ny:
R4( 5, ) 665 2-19
I(;-) y-g
Rs3 5 ,5) 041 C2 (%;-)
RC 455) 5 m (20-9 18)(1000- 1336) + (2o -e) (I300- 1334) +
R(3-5,4.5) C2
(150-116) ( 1803 -1336) +( (00-118) (n00-i336) t (130- 2)
(1s0-1336)
Points asigred to clust i: (40-118)+ (2o -te) + (15o-11a)+ (109- 1a) (133-i&)
, |+[5 = i-25
2 9408 t (-42) +14848 +2448 t528
4844 4t 1024t 324t 44
Centnoid 1 (l. 25, |-5)
2416 =il9|
fotnts assigned to duaten 2: 2280
, 3t5t35+ 4-5 3= 3.9 4 4+74 5+5t 45 5:
Caleul atiry the ntnupt (coi
Centrold 2:(34, 51)
As the centroid atten the a
tenatin enains unchayd, ’c= 69. 3g
hene, the agonthin convenys.
Now, or the advent'ement o $200, the salea shoutd be
220
Advertisetment (x) 20 50 13o

Sales cy) 1000 1300 1800 |200 1380 y l|91 (20o) + 6 38


* 245l. 38
15 Reoult
Prcdicted: spam Predd! not scam Totat Maths Carn(v)putn
(x)
Actue! 100
fail
Actual : not spam 20
Pass
Total |0 200
Pass

5 Fa|l
TNC True nyathve) 20
FP ( False positive) $0 5 Pass

FN (Falsc nyatve = 0

Acunauy Total
40+ 20 =
200
055
alg tudean calo ulae ditanee bun point a
Pre cision = 40 o52 6,S)
TP+FP Dist bo. (4,3) (4-6) +(3-s) 5-38

40 (G,4) (6-G)+ (+-8)


TP+FN Dt:

FI -Store 2. Pnedsion Reeal 2 052Xo9 Dot to (515) J5-6)+ (5-9)2 =316


Pre cisiton t Recol 52+ Þ.9 Drst bo (3, 8) JG- s)? (s -s)2 = 2
Specipirty TN 20 The neanest points ( ort eghbous) ane pts 2,3 and 5.
Sine, the majonity o% the neaest nushtbo una have the lasi "Pas , the
09
predictd ewlt

Givn:
FRR (False positive tate)z | - speukcity |- o2 o& Points: AI = (2,10) A2 (2, 5) A3= 8, 4) A4- (5 ,8)
A5 = (5) A6 (G4) A? , 2) A8 (4, 9)
Eps 2
MinP < 2

Cateulairy the distanes krom dikbtnet pints uty


Eucidean dstanee onmula.
21 At
point. cone2) Pts Min (as 4.12 46
a not A4
2) >ptMin (as A5.5 e2) Epe ithin Naboun 5 43:
point 24 4.A2:
Dit
NughbounA4 444 A4(5,8): fon d)
2.23 Al: om Dist.
4,9): As( fon h) 128 A7
538 Abi point A5141
2) Ptr Mn (as 5A4i
pa'nt A5
A 2 A41 6o8 A2:
unnajhbo
s nT 728 A3: &48 :Alton Dist.
2;tp:- ithin Nughboun 3l6 92: tA3(8.4): fon c)
8o6 Al: tom Dist.
(1,2): Aa n a)
38 5A8:
38 5 f\? |2 4A6:
(41 451 poYnt ot A2 5A5:
point cone a A6 412 A4:
naghboury 4-24 A4:
45A3,
tp2; wthin Njhboun 6.08 A3:
Dstam
2
t;pst? thin Nughbun 4.12 A2: AI:5
2| Alkon Dist, n2(2.5): r b)
4): AG(6, fon
2.23 AS:
5A8:
i
.21 A6!
point Cone a not Al
3.6 A4: nughbouns no
point 2 tpt th
Nghbour
A5
AG
A3, 5 A2
48 A3:
Nuybon Dist. 5 A?trom Dist.
4,5): As( fon e) AI(2,
10): fo a)
Come nts
Nohe poht A, 2 , A, A At

Jio 3l6 then


(one poBnts AS, A5, At

Noise ph A, A2, A,

points and nose points Hem atns Same

You might also like