Muhammad Anas ⚡️

Muhammad Anas ⚡️

08-09-2022

16:22

7 Scikit Learn hacks that you should be using, but I bet you aren't! Have a look below. Retweeting this tweet helps a lot!

1. Dummy Data for Regression You can generate your own random data to perform linear regression by using sklearn. It’s very useful in situations where you need to debug your algorithm or simply when you need a small random dataset. I use it for creating short tutorials!

2. Impute Missing Values with Iterative Imputer A lot of times we stick to simple and conventional methods to impute missing values, such as using mean. But let's go one step ahead! In this method, we'll use the entire set of features to estimate the missing values, Cool right?

3. Select from Model It is a meta-transformer for selecting features based on importance weights. You can choose from a range of estimators but keep in mind that the estimator must have either a feature_importances_ or coef_ attribute after fitting. Helpful if you ask me 😅

4. Build a Baseline Model for Classification How would you judge your ML model? What is the basis of your comparison? The solution is a baseline model. Note: This classifier is useful as a baseline to compare with real classifiers and these can't be used for real problems.

5. Plot a Confusion Matrix This generates an extremely intuitive and customizable confusion matrix for your classifier. Personally, I still love to use Seaborn's heatmap! I like that traditional feel!

6. Preprocessing Heterogenous Columns Real-world data is rarely homogenous, i.e, it contains columns with different data types. It becomes a challenge to apply different transformations separately on all columns. So here's a way to do that effectively. Butter right?

7. Model Persistence with Pickle We typically create a function to write a reusable piece of code, but what should we do when we want to reuse our model? We use Pickle! Sour right?

Well, folks, that's it for this thread. In a nutshell, we looked at 7 Scikit Learn hacks that you should be using in your day-to-day ML projects. If I missed any point, be sure to pinpoint it below! Btw, we just hit 400, so do consider giving me a follow. Love y'all 🔥🔥



Follow us on Twitter

to be informed of the latest developments and updates!


You can easily use to @tivitikothread bot for create more readable thread!
Donate 💲

You can keep this app free of charge by supporting 😊

for server charges...