Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Feature Engineering Cookbook

You're reading from   Python Feature Engineering Cookbook A complete guide to crafting powerful features for your machine learning models

Arrow left icon
Product type Paperback
Published in Aug 2024
Publisher Packt
ISBN-13 9781835883587
Length 396 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Soledad Galli Soledad Galli
Author Profile Icon Soledad Galli
Soledad Galli
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Chapter 1: Imputing Missing Data FREE CHAPTER 2. Chapter 2: Encoding Categorical Variables 3. Chapter 3: Transforming Numerical Variables 4. Chapter 4: Performing Variable Discretization 5. Chapter 5: Working with Outliers 6. Chapter 6: Extracting Features from Date and Time Variables 7. Chapter 7: Performing Feature Scaling 8. Chapter 8: Creating New Features 9. Chapter 9: Extracting Features from Relational Data with Featuretools 10. Chapter 10: Creating Features from a Time Series with tsfresh 11. Chapter 11: Extracting Features from Text Variables 12. Index 13. Other Books You May Enjoy

What this book covers

Chapter 1, Imputing Missing Data, explores techniques to replace missing values with suitable estimates for numerical, categorical, and time series data. It covers both single and multiple imputation methods and demonstrates how to streamline the imputation process using scikit-learn and Feature-engine.

Chapter 2, Encoding Categorical Variables, covers methods to transform categorical variables into numerical features. It begins with common techniques such as one-hot and ordinal encoding and then explores adaptations for high cardinality and linear models. The chapter also discusses domain-specific methods, such as weight of evidence, and demonstrates how to encode highly cardinal variables using methods such as target encoding, ensuring that you understand how to regularize the process to avoid overfitting.

Chapter 3, Transforming Numerical Variables, discusses when and why you need to transform variables for use in machine learning models. Then, it shows you different variable transformation functions and highlights which types of variables each function is best suited for. By the end of this chapter, you’ll understand when you need to transform your variables and why you apply the logarithm or the square root, among other functions.

Chapter 4, Performing Variable Discretization, introduces the concept of discretization, highlighting its uses in machine learning. The chapter then explores various discretization methods, detailing their advantages and limitations. It covers the basic equal-with and equal-frequency discretization procedures, as well as discretization using decision trees and k-means. Finally, it pairs discretization with encoding to return variables that are monotonic with the target.

Chapter 5, Working with Outliers, presents methods to identify outliers and understand their characteristics. It then discusses techniques to remove outliers or adjust their values to fit within accepted boundaries, utilizing pandas and Feature-engine.

Chapter 6, Extracting Features from Date and Time Variables, describes how to create features from dates and time variables. It covers how to extract date and time components from features, as well as how to combine datetime variables and how to work with different time zones.

Chapter 7, Performing Feature Scaling, covers methods to put the variables on a similar scale. It discusses standardization, how to scale to maximum and minimum values, and how to perform more robust forms of variable scaling. You’ll also find guidelines about which method to use, based on your model and variables.

Chapter 8, Creating New Features, describes various methods to combine existing variables to generate new features. It shows the use of mathematical operations to combine features based on domain knowledge. Then, it discusses how to transform features through the sine, cosine, and the use of splines. Finally, it shows you the value of creating features from one or more variables through decision trees.

Chapter 9, Extracting Features from Relational Data with Featuretools, introduces relational datasets and then moves on to explain how we can create features at different data aggregation levels, utilizing Featuretools. You will learn how to automatically create dozens of features from numerical and categorical variables, datetime, and text.

Chapter 10, Creating Features from a Time Series with tsfresh, discusses how to automatically create hundreds of features from time series data for use in supervised classification or regression. You’ll leverage the power of tsfresh to automatically create and select relevant features from your time series.

Chapter 11, Extracting Features from Text Variables, explores effective methods to clean and extract features from short text segments for use in supervised learning models. The chapter covers techniques to count words, sentences, and characters and measure lexical diversity. Additionally, it guides you through text cleaning processes and demonstrates how to build feature matrices by counting words.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image