Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question2: Tree This is a coding question. Write your own code to solve the following questions, and do not use the scikitlearn package. Given the
Question2: Tree This is a coding question. Write your own code to solve the following questions, and do not use the scikitlearn package. Given the data set (Y,X)={(0.53,0.33),(1.07,0.32),(2.16,0.88),(1.25,0.01),(2.32,0.71)} The mean square loss of a node m is defined as nm1iQm(yiym)2, where Qm is the set of node m, and nm=Qm. The optimal regression tree is the tree that minimizes the mean of the mean square loss, weighted by each node's size. (c) (2pt) Show all 25 possible regression trees with maximum depth 2 and calculate the weighted mean square loss for each tree. What Y would you predict given X=0.5 using the optimal tree. [ (d) (2pt) Which regression tree you found in the previous question is the recursive split optimum tree? What Y would you predict given X=0.5 using this tree? Given the data set (Animal,X)={(Cat,0.33),(Cat,0.32),(Dog,0.88),(Dog,0.01),(Cat,0.71)} If the target is a classification outcome taking on values 1,2,,K (in this case K=2 ), let pmk=nm1yQmI(y=k) be the proportion of class k observations in node m. The Gini index of a given node m is then defined as k=1Kpmk(1pmk) which measures the impurity of the node. The optimal classification tree is the tree that minimizes the mean of the Gini index, weighted by each node's size. (e) (2pt) Show all 25 possible classification trees with maximum depth 2 and calculate the weighted mean Gini index for each tree. Which animal would you predict given X=0.1 using this optimal tree. (f) (2pt) Which classification tree you found in the previous question is the recursive split optimal tree? Which animal would you predict given X=0.1 using this tree
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started