Model selection

We've looked at two different types of modeling techniques here, and for all intents and purposes, KNN has fallen short. The best accuracy on the test set for KNN was only around 71 per cent. Conversely, with SVM, we could obtain an accuracy close to 80 per cent. Before just simply selecting the most accurate mode, in this case, the SVM with the sigmoid kernel, let's look at how we can compare them with a deep examination of the confusion matrices.

For this exercise, we can turn to our old friend, the caret package and utilize the confusionMatrix() function.  Keep in mind that we previously used the same function from the InformationValue package.  The caret package version provides much more detail and it will produce all ...

Get Mastering Machine Learning with R - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.