Answered step by step
Verified Expert Solution
Link Copied!

Question

...
1 Approved Answer

8. Use package caret and train_data to create a random forest clas and answer the questions below. Create a random forest using var gen_election as

image text in transcribed
8. Use package "caret" and train_data to create a random forest clas and answer the questions below. Create a random forest using var gen_election as the target (class) variable and all of the other varia as predictors (do not include variables such as ID that you think sh be excluded from the analysis.). 8.1. (4 points) Use 5 as the value for ntree and use 2 as the val for mtry. What is the accuracy of the model? 8.2. (8 points) Keep ntree as 5, but change mtry to 7. What is th accuracy of the model? Between 2 and 7, which value of mtry would you recommend? 8.3. (4 points) Now use the recommended value of mtry but cha ntree to 10. What is the accuracy of the model? 8.4. (8 points) Now use the recommended value of mtry but cha ntree to 50. What is the accuracy of the model? Between 10 an 50, which value of ntree would you recommend? 8.5. (10 points) Use your recommended ntree and mtry to build random forest classifier based on train_data. Now make predict over test data. Set threshold at 0.5. Create the confusion matr and paste it in the space below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microeconomics An Intuitive Approach with Calculus

Authors: Thomas Nechyba

1st edition

978-0538453257

Students also viewed these Mathematics questions