Question: Q4. a. [3 points] Change Algorithm 1 to take a maximum depth parameter d. b. [1 point] Do we also need to change Algorithm 2

Q4. a. [3 points] Change Algorithm 1 to take a maximum depth parameter d.

b. [1 point] Do we also need to change Algorithm 2 ? Why?

Q4. a. [3 points] Change Algorithm 1 to take a maximum depth

3: 4: 5: 6: else 7 8: 9: Algorithm 1 DECISIONTREETRAIN(data, remaining features) 1: guess most frequent answer in data // default answer for this data if the labels in data are unambiguous then return LEAF(guess) // base case: no need to split further * else if remaining features is empty then return LEAF(guess) // base case: cannot split further // we need to query more features for all f e remaining features do NO + the subset of data on which f=no YES + the subset of data on which f=yes score[f] + # of majority vote answers in NO + # of majority vote answers in YES // the accuracy we would get if we only queried on f end for ft the feature with maximal score(f) NO + the subset of data on which f=no YES + the subset of data on which f=yes left + DecisionTREETRAIN(NO, remaining features \ {f}) right + DECISION TREETRAIN(YES, remaining features {f}) return NODE(f, left, right) 10: 11: 12: 13: 14: 15: 16: 17: 19 end if 2: : Algorithm 2 DECISION TREETEST(tree, test point) 1: if tree is of the form LEAF(guess) then return guess 3: else if tree is of the form Node(f, left, right) then if f = no in test point then return Decision TreeTest(left, test point) else return DECISION TREE TEST(right, test point) end if 4: 5: 6: 7: 8: 4 end if

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!