Feature Selection in Machine Learning with Python
$24.99
Minimum price
$29.99
Suggested price

Feature Selection in Machine Learning with Python

Over 20 methods to select the most predictive features and build simpler, faster, and more reliable machine learning models.

About the Book

Feature selection is the process of selecting a subset of features from the total variables in a data set to train machine learning algorithms. Feature selection is an important aspect of data mining and predictive modelling.

Feature selection is key for developing simpler, faster, and highly performant machine learning models and can help to avoid overfitting. The aim of any feature selection algorithm is to create classifiers or regression models that run faster and whose outputs are easier to understand by their users.

In this book, you will find the most widely used feature selection methods to select the best subsets of predictor variables from your data. You will learn about filter, wrapper, and embedded methods for feature selection. Then, you will discover methods designed by computer science professionals or used in data science competitions that are faster or more scalable.

First, we will discuss the use of statistical and univariate algorithms in the context of artificial intelligence. Next, we will cover methods that select features through optimization of the model performance. We will move on to feature selection algorithms that are baked into the machine learning techniques. And finally, we will discuss additional methods designed by data scientists specifically for applied predictive modeling.

In this book, you will find out how to:

  • Remove useless and redundant features by examining variability and correlation.
  • Choose features based on statistical tests such as ANOVA, chi-square, and mutual information.
  • Select features by using Lasso regularization or decision tree based feature importance, which are embedded in the machine learning modeling process.
  • Select features by recursive feature elimination, addition, or value permutation.

Each chapter fleshes out various methods for feature selection that share common characteristics. First, you will learn the fundamentals of the feature selection method, and next you will find a Python implementation.

The book comes with an accompanying Github repository with the full source code that you can download, modify, and use in your own data science projects and case studies.

Feature selection methods differ from dimensionality reduction methods in that feature selection techniques do not alter the original representation of the variables, but merely select a reduced number of features from the training data that produce performant machine learning models.

Using the Python libraries Scikit-learn, MLXtend, and Feature-engine, you’ll learn how to select the best numerical and categorical features for regression and classification models in just a few lines of code. You will also learn how to make feature selection part of your machine learning workflow.

  • Share this book

  • Categories

    • Python
    • Artificial Intelligence
    • Machine Learning
    • Programming Cookbooks
  • Feedback

    Email the Author(s)

About the Author

Soledad Galli
Soledad Galli, PhD

Soledad Galli is a seasoned data scientist, instructor, and software developer with over a decade of experience across esteemed academic institutions and renowned businesses. She specializes in developing and deploying machine learning models for assessing insurance claims, credit risk, and fraud prevention.


Sole is the leading instructor at Train in Data, where she shares her wealth of knowledge through online courses on machine learning, boasting an enrollment of over 50,000 students worldwide, consistently earning high praise. Additionally, she is the driving force behind the open-source Python library Feature-engine, currently enjoying a monthly download count of 150,000+.


In 2018, Sole was honored with the Data Science Leaders' award, and in 2019, she gained recognition as one of LinkedIn's influential voices in data science and analytics. Her passion for disseminating machine learning knowledge extends to speaking engagements at data science conferences and numerous publications on the subject, including a notable piece addressing the misuse of data and artificial intelligence.

Reader Testimonials

Tomás Insua
Tomás Insua

Exceptional material with crystal-clear explanations and code examples.

The explanations are very clear and easy to understand, and the use of examples with code makes the material very accessible. I particularly appreciated the section dedicated to explaining the mutual information-based feature selection methods. To enhance its value, consider adding more real-world applications and addressing common feature selection pitfalls. Overall, it's a fantastic resource for machine learning experts. Thank you for sharing your knowledge!

Sharat A
Sharat A

A must-have guide for data scientists and engineers

The book carefully breaks down various feature selection methods, from straightforward screening techniques to more advanced approaches, aimed at boosting model performance and algorithm efficiency. It also provides handy Python code examples, giving you a practical, hands-on approach to selecting the best feature subsets effectively. Each chapter builds upon the previous one, shedding light on both basic and advanced methods, making it an invaluable tool for beginners and experienced alike.

Paulo Cysne Rios Jr.
Paulo Cysne Rios Jr.

Clear, enjoyable, concise, and solid

The book covers several feature selection methods, including univariate selection, recursive feature addition or elimination, and feature shuffling. The book layout, including its Python code, is pleasant in electronic formats. Some books use a black or grey background for the code, which makes it hard to read on e-ink devices, but this book does not make this mistake. This book fills an elusive gap. Its focus on feature selection with Python is unique. Galli’s style is clear and engaging.

Arsalan Ali
Arsalan Ali

Complex topics are broken down into simple terms with easy to understand examples.

The book is written in an easy to understand way. Normally you'd have to spend hours or days to understand topics but the book provides you with a concise and clear explanation of the topics such as Quasi-constants, Mutual Information or Regularization. I really loved the Feature-Engine approach whenever it was used because of how easy it made the implementation. The book is quite easy to follow along and I myself love to read similar books where complex topics are broken down into simple terms.

Rahul Raoniar
Rahul Raoniar

Wonderful book

It is a wonderful book 📚. The explanations are to the point and crystal clear 😇. https://twitter.com/RRaoniar/status/1568211051329748994

Table of Contents

  • Preface
    • Who is this book for
    • What this book covers
    • Technical requirements
    • Download the code files
    • Get in touch
  • Chapter 1: Feature Selection Overview
    • What is feature selection?
    • Why do we select features?
    • Feature selection methods
    • Filter methods
    • Wrapper methods
    • Embedded methods
    • Other methods
    • Summary
    • References
  • Chapter 2: Basic Feature Selection Methods
    • Constant features
    • Quasi-constant features
    • Duplicated features
    • References
  • Chapter 3: Correlation of Predictors
    • Correlation coefficients
    • Visualizing correlated features
    • Remove correlated features: retain first, remove the rest
    • Remove correlated features: retain best feature, remove the rest
    • Correlation of categorical variables
    • Summary
  • Chapter 4: Filter Methods
    • Chi-square
    • Anova
    • Correlation
    • Mutual information
    • Refereces
  • Chapter 5: Univariate Feature Selection
    • Single feature model
    • Target encoding
    • References
  • Chapter 6: Wrapper Methods
    • Exhaustive search
    • Forward feature selection
    • Backward feature elimination
    • References
  • Chapter 7: Embedded Methods
    • Lasso
    • Feature importance from decision trees
    • Recursive feature elimination by feature importance
    • References
  • Chapter 8: Other Methods
    • Recursive feature addition
    • Recursive feature elimination
    • Feature shuffling
    • References
  • Next steps
    • Other books by the author
    • Online courses by the author

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub