Question: The data file diamonds_clean.rds Tasks 1. Read the diamonds_clean.rds data into a tibble and display it. 2. Split the data into training and testing data
The data file
diamonds_clean.rds
Tasks
1. Read the diamonds_clean.rds data into a tibble and display it.
2. Split the data into training and testing data sets, where the testing data set consists of 20% of the total data.
3. Create an initial classification decision tree model, but don't specify any values for the hyperparameters except for mode.
4. Fit the model to predict the Clarity variable using all independent variables and view it.
5. Plot the fitted decision tree.
6. Use the model to get predictions for the test dataset.
7. Display a confusion matrix for this model.
8. Display the variables for this model sorted by importance.
9. Create a new decision tree model, but this time set the hyperparameters set manually. (Larger values for tree_depth and smaller values for min_n and cost_complexity should help your model).
10. Fit the new model to use two important variables from the previous model.
11. Get a new set of predictions for the testing data using the new model.
12. Display a confusion matrix for the new model. Did your accuracy improve? If not, try adjusting the hyperparameters again.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
