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
To import the Auto dataset into Rstudio: library("ISLR") data(Auto) view(Auto) Then, provide necessary codes for the...
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. 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 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...