This question uses the Caravan
data set from the ISLR2
package.
We first create a training set consisting of the first 1000 observations, and a test set consisting of the remaining observations.
set.seed(1)
train <- 1:1000
Caravan$Purchase <- ifelse(Caravan$Purchase == "Yes", 1, 0)
Caravan.train <- Caravan[train, ]
Caravan.test <- Caravan[-train, ]
Purchase
as the response and the other variables as predictors.
Use a seed of 1, 1000 trees, bernoulli distribution and a shrinkage value of 0.01.
truepositive
.Assume that:
ISLR2
and gbm
libraries have been loaded.Copy the preprocessing code given above in your solution