Question

To import the Auto dataset into Rstudio: library("ISLR") data(Auto) view(Auto) Then, provide necessary codes for the...

To import the Auto dataset into Rstudio:

library("ISLR")
data(Auto)
view(Auto)

Then, provide necessary codes for the following:

a. Create a binary variable FuelEfficient that takes on the value Yes or 1 if mpg is greater than 25
and takes on the value No or 0 if mpg is less than, or equal to, 25.
b. Split the data into a training set and a test set.
c. Fit a tree to the training data with FuelEfficient as the response variable.
d. What is the training error rate?
e. Predict the response on the test data. Produce a confusion matrix and calculate the test error rate.
f. Use cross-validation in order to determine the optimal level of tree complexity.
Plot the pruned tree. How many terminal nodes are in the pruned tree?
g. Compare the training error and test error of the pruned tree and full tree.cross

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
To import the Auto dataset into Rstudio: library("ISLR") data(Auto) view(Auto) Then, provide necessary codes for the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is how you import the Carseats data into Rstudio software: library(“ISLR”) data(“Carseats”) ...

    This is how you import the Carseats data into Rstudio software: library(“ISLR”) data(“Carseats”) view(Carseats) after that, please provide codes for following: a. Split the data into a training set and a test set. b. Fit a linear model using least squares on the training set to predict Sales using the entire collection of predictors. Report the Cp, BIC, R2, and RSS for this model c. Use the fitted model to predict responses for the test data and report the test...

  • Problem 1 (Logistic Regression and KNN). In this problem, we predict Direction using the data Weekly.csv....

    Problem 1 (Logistic Regression and KNN). In this problem, we predict Direction using the data Weekly.csv. a. i. Split the data into one training set and one testing set. The training set contains observations from 1990 to 2008 (Hint: we can use a Boolean vector train=(Year < 2009)). The testing set contains observations in 2009 and 2010 (Hint: since train is a Boolean vector here, should use ! symbol to reverse the elements of a Boolean vector to obtain the...

  • The ACME Manufacturing Company has hired you to help automate their production assembly line. Cameras have...

    The ACME Manufacturing Company has hired you to help automate their production assembly line. Cameras have been placed above a conveyer belt to enables parts on the belt to be photographed and analyzed. You are to augment the system that has been put in place by writing C code to detect the number of parts on the belt, and the positions of each object. The process by which you will do this is called Connected Component Labeling (CCL). These positions...

  • I've posted 3 classes after the instruction that were given at start You will implement and...

    I've posted 3 classes after the instruction that were given at start You will implement and test a PriorityQueue class, where the items of the priority queue are stored on a linked list. The material from Ch1 ~ 8 of the textbook can help you tremendously. You can get a lot of good information about implementing this assignment from chapter 8. There are couple notes about this assignment. 1. Using structure Node with a pointer point to Node structure to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT