Book Image

Applied Supervised Learning with R

By : Karthik Ramasubramanian, Jojo Moolayil
Book Image

Applied Supervised Learning with R

By: Karthik Ramasubramanian, Jojo Moolayil

Overview of this book

R provides excellent visualization features that are essential for exploring data before using it in automated learning. Applied Supervised Learning with R helps you cover the complete process of employing R to develop applications using supervised machine learning algorithms for your business needs. The book starts by helping you develop your analytical thinking to create a problem statement using business inputs and domain research. You will then learn different evaluation metrics that compare various algorithms, and later progress to using these metrics to select the best algorithm for your problem. After finalizing the algorithm you want to use, you will study the hyperparameter optimization technique to fine-tune your set of optimal parameters. The book demonstrates how you can add different regularization terms to avoid overfitting your model. By the end of this book, you will have gained the advanced skills you need for modeling a supervised machine learning algorithm that precisely fulfills your business needs.
Table of Contents (12 chapters)
Applied Supervised Learning with R
Preface

What Metric Should You Choose?


Another important aspect to consider on a serious note, is which metric we should consider while evaluating a model. There is no straightforward answer, as the best combination of metrics completely depend on the type of classification use case we are dealing with. One situation that commonly arises in classification use cases is imbalanced classes. It is not necessary for us to always have an equal distribution of positive and negative labels in data. In fact, in most cases, we would be dealing with a scenario where the positive class would be less than 30% of the data. In such cases, the overall accuracy would not be the ideal metric to consider.

Let's take a simple example to understand this better. Consider the example of predicting fraud in credit card transactions. In a realistic scenario, for every 100 transactions there may be just one or two fraud transactions. Now, if we use overall accuracy as the only metric to evaluate a model, even if we predict...