$30.00
Description
In this homework, you will implement a decision tree regression algorithm in R, Matlab, or
Python. Here are the steps you need to follow:

You are given a univariate regression data set, which contains 272 data points about the duration of the eruption and waiting time between eruptions for the Old Faithful geyser in Yellowstone National Park, Wyoming, USA (https://www.yellowstonepark.com/thingstodo/aboutoldfaithful), in the file named hw05_data_set.csv.

Divide the data set into two parts by assigning the first 150 data points to the training set and the remaining 122 data points to the test set.

Implement a decision tree regression algorithm using the following prepruning rule: If a node has or fewer data points, convert this node into a terminal node and do not split further, where is a userdefined parameter.

Learn a decision tree by setting the prepruning parameter to 25. Draw training data points, test data points, and your fit in the same figure. Your figure should be similar to the following figure.
Waiting time to next eruption (min)
P=25
training 
● 
● 
● 

90 
● test 
● 
● 
●● 

● 
● 
● 

● 
●● 
_{●}● 
● 

● 
● 
●● 
● 

● 
●●● 

80 
● ●● 
● ^{●} 

● 
●●● ● 
● ● 

● 
●_{● ●}● 
● ● 
● 
● ● ● 

● 

●● 
● ● 
● ● 
● 
● 
● 

● 
● 
● 
● 

● 

70 
● 
● 
● 
●_{●} 

● 
● 
● 

● 
● ● ● 

● 
● 
● 

● 
● 
● 

60 
● 
● 
● 

● 
● 

● 
● ^{●} 
● 

● 
● 
● 
● 

●● 
● 

50 
● ● _{●} 
● 
● 
● 

●●● 
● 
● 

● 

●_{●} ^{●}
●
2 3 4 5
Eruption time (min)

Calculate the root mean squared error for test data points. The formula for RMSE can be written as
^{∑}^{01231}^{(* ,* )}^{/}
_{RMSE=’} _{+45} + + _{.}
Your output should be similar to the following sentence.

Learn decision trees by setting the prepruning parameter to 5, 10, 15, …, 50. Draw RMSE for test data points as a function of . Your figure should be similar to the following figure.
RMSE
●
7.5
7.0 
● 

● 
● 

6.5 
● 
● 


●
●
●
●
10 20 30 40 50
Pre−pruning size (P)
What to submit: You need to submit your source code in a single file (.R file if you are using R,
.m file if you are using Matlab, or .py file if you are using Python) and a short report explaining your approach (.doc, .docx, or .pdf file). You will put these two files in a single zip file named as STUDENTID.zip, where STUDENTID should be replaced with your 7digit student number.
How to submit: Submit the zip file you created to Blackboard. Please follow the exact style mentioned and do not send a zip file named as STUDENTID.zip. Submissions that do not follow these guidelines will not be graded.
Late submission policy: Late submissions will not be graded.
Cheating policy: Very similar submissions will not be graded.