O'Reilly logo

Mastering Machine Learning with R - Second Edition by Cory Lesmeister

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required