You are on page 1of 37
_— SSN COLLEGE OF ENGINEERING Sheet Ne RECORD SHERT Spandana J $ N 312216208100 pda t DECISION TREE CLASSIFICATION To perform classification using decision tree classifier in WEKA tool ALGORITHM: on tree form training tuples of data partition D Inpat Data partition, D, which is a set of training tuples and their associated class labels. attribute_list, the set of candidate attributes. Attribute selection method, a procedure to determine the splitting criterion that best partitions that the data tuples into individual classes. This criterion includes a splitting_attribute and either a spitting point or spi g subset, Output: A Decision Tree Method create a node N; if tuples in D are all of the same class, C then return N as leaf node labeled with class C: if atribute_list is empty then i return N as leaf node with labeled with majority class in D;| majority voting. apply attribute_selection_method(D, attribute_list) to find the best spitting_criterion; label node N with splitting_criterion; if splitting_attribute is disercte-valued and ‘multiway splits allowed then // no restricted to, base attributc_list = splitting attribute; // remove spl ing bt for each outcome j of splitting criterion 11 partition the tuples and grow a Go cath pasion let Dj be the set of data ‘uplesip'D satisfying outcome j; //« partition & Spandana J S N 312216205100 if Dj is empty then attach a leaf labeled with the majority class in D to node N; else attach the node returned by Generate decision tree(Dj, attribute list) to node N; end for return N; PROCEDURE: 1. Open Weka tool and choose Explorer and load the data file into the preprocessing tab. 2. Goto Classify tab — click choose button — select J48. 3. Click — Start button. 4. Right click trees-J48 — choose Visualize Tree option. SSN COL! 2 OF E) GINEERING Sieur Nn SS RECORD SHEET wider The weother Ort dotorset ; ow’ SSN COLLEGE OF ENGINEERING Sheet No. RECORD SHEET ne 2 oth leute te 4 Tafrrmotio ~ Goan en le Pan ; . dllference > motion Gain we ti mearmnre g te HY ee pce) RCE) Po oe Cyt he number g elerrants park & elena SHE YEERING § h he whos $e Chelation a a ; ft PrN Cr ~ fog ( : aa fan) Wo YE ee ce vToroh : Ih Te 7 + 54 ©) 4 > ( WL) an Rovmal) See ve Yu 1 EZRA ‘weather nommnal art £3 @relation weather. symbolic @attribute outlook (sunny, overcast, rainy} @attribute temperature (hot, mild, cool} @attribute humidity (high, normal} @attribute windy (TRUE, FALSE} @attribute play (yes, no} @data sunny, hot, high, FALSE, no jit sunny, hot, high, TRUE, no | overcast, hot, high, FALSE, yes mild, high, FALSE, yes ‘cool, normal, FALSE, yes 001, normal, TRUE, no normal, TRUE, yes rainy,’ < rainy, 15 rainy, overcast, cool, > sunny, mild, high, FALSE, n° sunny, cool, noxmal, FALSE, yes rainy, mild, normal, FALSE, Y&S ) Sunny, mild, normal, TRUE, Yoe / svereast mild, high, TRUE, Yee overcast ,hot, normal, FALSE, Yoo rainy, mild, high, TRUE,ne Spandana J S$ N 312216205100 oureut: oss Validation: (No. of correctly classified instances *100)(Total no, of instances) 10 Folds ee jer Accuracy: (7* 100y/14 = 50% (i) Percentage split ~ 50% “ 312216205100 (own me [emrocene [cma] omstes | Aemocime | Setters | Vince] ] comme [s00-€ 0 28.02 | root pttonm ee waning eet | mee net ont | coommwamaatton © Pecomange som ome = EES == [Datei - sesea2 rome eesgneed MD SHAE AM fomsnaen Loses | os | — |e Ce wean ane he |S Sem et eat Se vant © rvettage net Mee ee os ~ W004 Liao | Wil ian RE Lay, ne [on [| 3*100¥6 = 80% (No. of instances used fi Shomitaiin 8N SM ay or testing £6) Spanaana > 1 S12716209100 ont tat tht toh a ttt 22341 -weon i ; kL Dot ne me Accuracy: (2*100)/5 ~ 40% (No. of instances used for testing : 5) onctusion: Pereentage split of 50% has provided better accuracy than other splitting Spandana 1% 6 312216205100 y = seg/in the Weka tool and the tree Henee the Decision ‘Tree classification algorithm has been has been visualized. Spandana 1 8 N Ste20s100 patios * BAYESIAN CLASSIFICATION Pain 29-08-14 jo perform classification using Nayesian olossifier in WEKA tool Haye hee pv yen of eleuing the user protaiity, Pele em Fh Pa) an 109 wlannitior assume outer preatictors, Uhis assumption is called claws conditional indepen whe perenne Liketinood Class Prior Probabiity P(c| x) P(xle)P(e) | P(x) Posterior Probability Predutor Prior Probabitty P(E LX) = PCA, Le) * POA, Lede PO, Led PEO) sy (rargel) + P(clx) is the posterior probability 0 given predictor (attribute), + Pic) is the prior probability of clays + Plxle) is the likelihood which is the probability of predictor given ele P(x) is the prior probability of predictor PROCEDURE; 1. Open the data file diseretized. Weka Explorer Is presumed that the require dat Hells hae Poon nd click choose button (9 select the “NavigHayes” in the 2. Next we select the “classify” tl classifier, jtfed by clicking im the text box we ean be NPew is totaal we acgpt the dofiaalt values bi dro pruning, parameter The: In this example, 1, bat does not perlorny 3, Now we specify the various ‘6 the right of the chose button Version does perform some prunit RING Sheet N SSN COLLEGE OF ENGINE RECORD SHEET Spandana J SN 312216205100 Since we don’t have |, We select the 10-fold cross validation as our evaluation approach, separate evaluation data set, this is mocessary to get a reasonable penerated model « We now click start to generate the model, the ASCH version of the tree as well as evaluation statistic will appear in the right panel when the ‘model construction is complete. ww a graphical version of the classification tree. 6. Now weka also lets us a 7, We can further use our model to classify the new instances. et OF ENGINEERING __ Sheet No. RECORD stn INEERING = S! ost \ rer dotacel a | ity [te Hud, Fala Ne \ Hot Wik | Tres Ne a | Hot ie Fala Mew 3 | Sunny tad Hedda Folre Ye Sw ay (eel Rovmak | fore Yes ‘ Sanmns Lert Normal | True | Ne Yes b. |) Qvercark] Cool Nowe) | Tene a | Rony me | Way | Fett ne 4g Rony Cool Nevwoh a. | sunny HELA | Novel BOUL | Norma — SSN COLLEGE OF ENGINEERING #1 RECORD SHEFT © Raspone verter Centar Mee Vols % lars Vertobte (prediction oA culpa) oe ~ers ae Tr ebore dadovek » ta Clank Verteabla name Ploy ae Bane: Theorem sat Bayes’ Theoven Pads ‘The probe sy ed eon an 1 pachabiity q Man event Mut hes oe Occuyve dL. By. > thaoven, a Atatedk wetbematicalley eo oe Yilnsing eqprotion Pealey = SCeiAd. Bay P(e) New ) ott reaonds Fo on dotorek » we con eepky }Sayes' theorem in follwing my: Plalxd = © Ely)- eG) P(x) Where) yo Clans varies ond X ts 0 dependent otere vecte&X CH Ae A here Vorably ave 9 X= (Raine, Hot » High, Fase) L Example. \> Ne So, ik R= HI, %, a) ———— oY COLLEGE OF EN, : , GINE 1 RECORD sii T ~~ RING aati om * De veces Contain OX Output) we eau Ober dotnet , he (predicts on oe Me th Veorviokle, Poe ee Rema le om Varebe ‘Ploy ae Bate hice Bayes’ ea hee ee Prehebitty a an evap een en AL Prsbabicny H orear ere Hop hee olves A. Sccurvve d te a the Vining protion « = FaIny. eA POA\R) EG) Xe) P(e 1 oestty >sAanda to ow datoret ' Boyes! theorem in ellos a oy * = Coy). eg Flap = ERdy) eq) PR) ‘4 Chars Vortoble ond X ib o dependent kerb vecte® Ce Ae A) hore, Voriably are: Si t Example X= Cain, Rot, Wihs FA) 1 ft y= No Sop ye A = ee) Readtone ts cally News 7 SR Con ery Uhre , SSN COLLEGE OF ENGINEERING ‘ 1) RD SHEET Noe | Ne | P(Yer) | Pn Rainy a 2 aq 2/s lov f Het: 2 2 > Ie, 2s wld 4 a 4}y | 7/5 cd 3 \ ala Vs Total 4 5 oo) ) ee »SN COLLEGE OF ENGINEERING Yes Ne | Pe) | PUN) | Hg | . 4 | | | tet] | | S/o Tors | 9 ‘ | ioe7. | too’ 1 ~d : No _| Ne | Ae)! (ne) ; | T aaa folre | 4 2 | bla | 2H | | T |} 2 [3 | sly | x. | | | Toto 4 | 5 | lol lov/ | Plan, Ploy Probabilities Yes | 4 9] ky | | No s shy -GE OF F se RECORD sue GINEERING Jest “a bt » i N Se Set an ‘ E dative fa ; _ 0 Py 3 Probabith, . HOE, Novmol Ff 1% plan wae) Sol S Rren eden e er [oa oes) (bee (Yes) Nomal 1, Sh. \ ee Nes)? P(t >) ta Yrvebal hy a . Mol Gdbuhi | op. - : No cdo) P C JOsevk| Ne) PC re. ch PRermaltuncatty [hi ) en Se enmaeean ct Plena, PE IS geen by Sind (No) P(N) P eda) S Common KR boh Con ignore PUdaw) od fad py 5 4 b On Pe today) OL ond |b P (Wo tedew) of 24 Now , Bac 5 a) And be Perl ted) + 2 (Nol tedoy SSN COLLEGE OF RECORD SHEE NEERING Sheet No, ..43... re Rembesr n> be Converted into a prebabichy my || We Aum eqpal to | Crovmeligotion) wal 4 | C(Yer | day) Soe = Ob2 O.o1mpl + 0: 0068 Pena) cea = 0 OO | O-OUR| + 00068 PLNes| ody) 7 ceaik Thek & Nes £ (Nol todo) peered be plays Weany,\7 Prebtcion * INPUT DATASET: Spandana J SN 221e20S100 Class attribute: play (yes of na) MUS humidity, windy, play) Number of instances: i weather.nominal.arfY dataset deseril Given the weather conditions, cach ae for plaing golf, the Weather conditions fr playing a game of golf.

You might also like