Chapter 4: Encoding, Transforming, and Scaling Features
The first three chapters of this book focused on data cleaning, exploration, and how to identify missing values and outliers. The next few chapters will delve heavily into feature engineering, starting, in this chapter, with techniques to encode, transform, and scale data to improve the performance of machine learning models.
Typically, machine learning algorithms require some form of encoding of variables. Additionally, our models often perform better with scaling so that features with higher variability do not overwhelm the optimization. We will show you how to use different scaling techniques when your features have dramatically different ranges.
Specifically, in this chapter, we will explore the following main topics:
- Creating training datasets and avoiding data leakage
- Identifying irrelevant or redundant observations to be removed
- Encoding categorical features
- Encoding features with medium or high...