Question: 24. Use the mnist_27 training set to build a model with several of the models available from the caret package. For example, you can try

24. Use the mnist_27 training set to build a model with several of the models available from the caret package. For example, you can try these:

models <- c("glm", "lda", "naive_bayes", "svmLinear", "gamboost", "gamLoess", "qda", "knn", "kknn", "loclda", "gam", "rf", "ranger","wsrf", "Rborist", "avNNet", "mlp", "monmlp", "gbm", "adaboost", "svmRadial", "svmRadialCost", "svmRadialSigma")

We have not explained many of these, but apply them anyway using train with all the default parameters. Keep the results in a list. You might need to install some packages. Keep in mind that you will likely get some warnings.

25. Now that you have all the trained models in a list, use sapply or map to create a matrix of predictions for the test set. You should end up with a matrix with length(mnist_27$test$y) rows and length(models) columns.

26. Compute accuracy for each model on the test set.

27. Build an ensemble prediction by majority vote and compute its accuracy.

28. Earlier we computed the accuracy of each method on the training set and noticed they varied. Which individual methods do better than the ensemble?

29. It is tempting to remove the methods that do not perform well and re-do the ensemble. The problem with this approach is that we are using the test data to make a decision. However, we could use the accuracy estimates obtained from cross validation with the training data. Obtain these estimates and save them in an object.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!