Learn about 19 Sklearn features you have never seen that are direct and elegant replacements to common operations you do manually.
Image by me with Midjourney
Introduction
After three years of use and by looking at the API reference of Sklearn, I have realized that the most commonly used models and functions are only a thin slice of what the library can do. Even though some features are extremely narrow-focused and used for rare edge cases, I have found many estimators, transformers, and utility functions that are more elegant fixes to common operations people do manually.
So, I have decided to make a list of the most elegant and important ones and briefly explain them so that you can significantly expand your Sklearn toolset in a single article. Enjoy!
covariance.EllipticEnvelope
It is common for distributions to have outliers. Many algorithms deal with outliers and EllipticalEnvelope is an example that is directly built-in to Sklearn. The advantage of this algorithm is that it performs exceptionally well at detecting outliers in normally distributed (Gaussian) features: