R Tutorial: Data normalization

Rafael teaches data normalization for machine learning, covering min-max scaling and z-score standardization. Min-max scaling maps features to 0-1 but is sensitive to outliers; z-score scaling is more robust but produces different numeric ranges. Most ML algorithms like SVM and k-NN need scaling, but decision trees don't.
Chapters
Hi, my name is Rafael and I will be your instructor for this course. Have you ever wondered what a machine learning interview looks like? Well, this course will help you prepare for it by answering 30 questions that will put both your theoretical machine learning knowledge and R coding skills to the test. Let's dive in. The first chapter is about data pre processing techniques. You will learn about data normalization, handling missing data and detecting outliers. Chapter two is devoted to supervised learning. We will cover important aspects to consider when developing regression or classification models. We will also discuss the three most common strategies for model assembly. In chapter three, you will hone in your unsupervised learning skills through questions about clustering and dimensionality reduction. Finally, in chapter four, you will delve into model selection and evaluation, including imbalanced classification and hyper parameter tuning. You will wrap up studying the algorithmic differences between two very popular ensemble models, random forest and gradient boosted trees. Keep in mind that this course is meant to be more challenging than your average data cam course. Make sure to complete your prerequisite courses so you can gain the most out of the topics we will cover. Now that you know what we'll be covering in the course, let's get started with data normalization. Data normalization, also called feature scaling, is an important step in your data pre processing pipeline. Although it is not always needed most of the times it will be beneficial to your machine learning. Model decision trees, for example, can deal quite well with features having dissimilar and disproportionate scales, but sadly this is not the case for the majority of the machine learning models you will often use, such as support vector machines k nearest neighbors, logistic regression, neural networks, or an entire suite of clustering and feature extraction algorithms. It is therefore a good practice to consider normalizing your data before passing it on to other components in your machine learning pipeline. Min max scaling is a very common way to normalize the data. It scales every feature value between its minimum and maximum. In the scaled version, the minimum value is mapped to zero, the maximum is mapped to one, and the rest of the values lie in between. Another popular method is called standardization or z score normalization. It represents a numerical value as units of standard deviation from the feature mean. As a result, values below the mean will be mapped to negative units and values above the mean will be mapped to positive units. Here's a scatterplot of 100 FIFA players, ages and their monetary value in millions of euros. We immediately notice the difference in the feature scales, which will be problematic for many machine learning algorithms. When trying to compute distances. For example, to make things worse, there is an erroneous observation color in red, which is clearly an outlier. Min max scaling brought both feature scales to the 01 interval. However, the new age values are in the 0 to 0.3 range due to the presence of the outlier, so the white axis will still dominate when these two features are compared. The z score method showed more robustness to the outlier, as both features are now in the minus 1 to 2 range, although their ranges are not identical. To summarize, min max normalization ensures that all features will share the exact same scale, but does not cope well with outliers. Set score normalization, on the other hand, is more robust to outliers, but produces normalized values in different scales. Time for you to practice.
More from Richie

#359 My Best Friend is AI with Valerie Tiberius, Professor of Philosophy at University of Minnesota

How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

#358 How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon







