Limited-time discount for students! | Solutions starting at $6 each.

Assignment:. Write a python program to implement the Hu

Added on - 16 Sep 2019

  • 1

    Pages

  • 431

    Words

  • 114

    Views

  • 0

    Downloads

Trusted by +2 million users,
1000+ happy students everyday
Showing pages 1 to 1 of 1 pages
Assignment:Writeapython programtoimplementthe Huntsalgorithm fordecision tree:1.Function 1 to build a decision tree:a.Theinputis alist of tuples:i. Thefirsttuple ofthis lististo describetheattributetypeof theitemsinthe rest of the list. Theattributetypescould ben, ‘o, ‘c’,and ’l’fornominal, ordinal,continuous,and label, respectively. Notethat wecanassumethelabel attributel’ is alwaysthe lastattributeinthetuple,and it’s value isalwayseither 0or 1.ii. Therest of the listis offixed sized integer-tuples.iii.Forexample,[(n’,n’,c’,’l),(1,0,125,0),(0,2,100,0), ...]iv. Notethatallthe input valuesareof integer.Forexample, wecanconvert ourexample intheppt file,yes/noto be1/0.b. Theoutputis a tree-likestructurewhichcould be atupleof tuplesasdescribedintheclass.(left-child, information ofcurrent node, right-child). Pleasenotethat nullpointer is the keywordNoneinPython.c.Thechoiceofattribute for next node isin the same order ofinputattribute.Thatis, root nodeis based on first attribute,and itschild nodesaretheattribute2.d. Assume that each nodecan haveatmosttwochildren.e.Wecanassumethe inputlistis legitimate. Thatis, wedo not need to checkthe qualityof theinput.f.You might need tocreatemorefunctionsto becalled to completethe tasksforthis function.2.Function 2returnsalabel(class)for agiven tuplewhich issame structure(withoutlabel)as the tuple inthelistof thefirst function.a.Forexample, the inputcould be(1,0,120)compared totheexampleoffunction 1above.b. Theoutputis eitherthe label which is 0 or 1for this assignment.3. Create oneexamplebyconvertingourexamplefromtheppt file,and test theresultswith newtuples.
desklib-logo
You’re reading a preview
Preview Documents

To View Complete Document

Click the button to download
Subscribe to our plans

Download This Document