VietnamFind a local group near you
🎯Selecting Smartly: An Ensemble Approach for Feature Selection by Different Importance Metrics.

Imagine you’re a coach with a long list of players — some are stars, some are out of form, and others are still rough around the edges. But here’s the catch: you can only pick a limited number for your team. You don’t just want the best players, you also want the ones that fit your game plan. That’s pretty much what we’re doing in machine learning when we pick the best, most relevant features out of hundreds to build a solid model for a specific purpose.
So, how do we actually do Feature Selection when we have to shrink our feature set from hundreds (or even thousands) down to just a few dozen? Let’s find out!
What is Feature Selection and why should we care about it?
Feature Selection usually comes into play after we’ve gone through EDA, cleaned our data, created new fields, and done some feature engineering. At this point, it’s not uncommon to end up with hundreds — or even thousands — of features in our dataset.
You’ve probably heard about the Curse of Dimensionality in machine learning — it pops up everywhere. Having too many features doesn’t just make your model overly complex and prone to overfitting, it also makes the entire modeling process way harder. I’m specifically talking about hyperparameter tuning — one of the most compute-intensive steps in the entire modeling process. It’s not that the data scientist is doing a lot during this step — it’s the machine that’s stuck crunching numbers for hours (days). Trust me, you don’t want to sit through 10+ minutes just to train a single model, especially when tuning often requires hundreds of training runs.
On top of that, there’s the issue of interpretability. When your final model includes too many features, explaining how it works becomes a nightmare. This is especially true in industries like finance and banking. For example, trying to explain hundreds of features to stakeholders or regulators? Yeah… not fun.
So now you see why having too many features is a problem. That’s exactly where Feature Selection comes in — it helps us cut down the noise and focus only on the features that actually matter.
Common Methods for Feature Selection
Alright, now that we understand why Feature Selection is important, let’s dive into how we actually do it. There are three main approaches: Filter, Wrapper, and Embedded methods. Each has its pros and cons, and the best choice depends on your data, model, and goals.
1. Filter Methods
These methods evaluate each feature individually based on its statistical relationship with the target variable. They don’t rely on any specific machine learning model — just pure statistics.
Popular techniques:
- Chi-square test: A statistical test to measure how much a feature and the target variable are dependent on each other, based on frequency distribution.
- Correlation Coefficient: Measures the linear relationship between features. Features that are highly correlated with each other can be removed to reduce redundancy.
Pros:
- Fast and computationally cheap
- Great for very large datasets
Cons:
- Doesn’t consider feature interactions
- Doesn’t handle multicollinearity well
- Might keep redundant features that individually seem important
2. Wrapper Methods
These methods use a machine learning model to evaluate different subsets of features and pick the combination that gives the best model performance.
Popular techniques:
- Forward Selection: Start with no features and add them one by one, keeping those that improve performance.
- Backward Elimination: Start with all features and remove them one at a time based on performance drop.
- Recursive Feature Elimination (RFE): Iteratively train the model, rank feature importance, and remove the least important features in each round.
Pros:
- Takes into account feature interactions
- Usually gives good model performance
Cons:
- Computationally expensive, especially with lots of features
- Requires fixing the model’s hyperparameters in advance, so the selected features might not be truly optimal — they’re only the best under the current setup
3. Embedded Methods
These methods perform feature selection as part of the model training process itself. Think of it as “feature selection built-in.”
Popular techniques:
- L1 Regularization (Lasso): Penalizes less important features by shrinking their weights to zero, effectively removing them from the model.
- Tree-based models (Decision Trees, Random Forest, Gradient Boosting): Estimate feature importance using metrics like information gain or impurity reduction during tree splitting.
Pros:
- Efficient — saves time by combining training and feature selection
- Often leads to good performance with less effort
Cons:
- Results may vary depending on the model and its hyperparameters
- Might not generalize well if the model used isn’t a good fit for your problem
Proposed Method — Ensemble Approach
All the methods we’ve discussed so far aim for the same goal: selecting a subset of features that gives us the best model performance. The proposed method shares that goal — but with an added benefit: flexibility in choosing how many features to keep, depending on your specific use case or resource constraints.
Now imagine this — what if we had several different rankings of feature importance, each created using a different perspective? For example:
- Feature gain in tree-based models
- How much model performance drops when we remove a feature
- The impact of shuffling a feature’s values
- Or SHAP values that explain a model’s decisions
If we combine all of these rankings, wouldn’t we get a more robust and reliable overall feature ranking? Let’s break down what each method brings to the table — and how they can complement each other’s weaknesses.
💡 Real-life tip:
These methods below — especially BorutaShap, and LOFO — can be quite time-consuming, especially on datasets with thousands or even tens of thousands of features. That’s why, in practice, I often start with Filter or simple Wrapper methods to trim the number of features down to a few hundred at most.
This first-stage reduction helps make the more advanced techniques much more manageable in terms of computation — and your machine will thank you later!
1. Importance Ranking from Tree-Based Models
Let’s start with something familiar: Gradient Boosted Trees, specifically XGBoost (though the same applies to LightGBM, CatBoost, etc.). These models give us multiple ways to measure feature importance:
- Weight: The number of times a feature is used to split the data in decision trees. Higher weight means the feature is frequently used — but it doesn’t tell us how much the model improves with that split.
- Gain: Measures the average improvement in the loss function when a feature is used for splitting. A high gain means the feature plays a big role in reducing model error.
- Total Gain: Unlike regular gain (which is an average), this is the sum of gains from all the times a feature is used — giving you a sense of its total contribution to the model.
- Cover: Reflects how many observations (data points) are affected by splits on that feature. It’s a proxy for how broadly a feature influences your dataset.
2. BorutaShap
This technique combines the Boruta algorithm with SHAP values to produce more reliable rankings.
Here’s how it works:
- Shadow features are created by shuffling the original features — essentially introducing “noise” features.
- A model is trained, and SHAP values are computed. If a real feature has consistently higher SHAP values than the shadow features, it’s considered important.
- This process is repeated multiple times for more stability, and in the end, we get a ranked list of meaningful features.
BorutaShap helps eliminate noisy or misleading features and is great at identifying strong signal vs random patterns.
3. Permutation Importance
This method kicks in after the model is trained.
Here’s the idea:
You shuffle the values of a single feature to break its relationship with the target variable, and then measure how much the model performance drops (e.g., AUC score, RMSE). The more the drop, the more important the feature.
It’s simple and model-agnostic, but can be computationally heavy if your dataset is large.
4. Leave-One-Feature-Out (LOFO) Importance
LOFO is another model-agnostic technique. The idea is pretty intuitive:
- You remove one feature at a time, retrain or re-evaluate the model, and observe how performance changes.
- The bigger the drop, the more important that feature was.
This method gives a very realistic view of a feature’s true impact, including how it interacts with others. It also helps filter out redundant features — if a feature is strongly correlated with others, removing it might not hurt performance, so it won’t rank high.
How to Use These Methods (with Code)
Each method brings a different perspective to the table:
- LOFO is great for identifying redundant features and capturing how feature interactions impact model performance.
- BorutaShap and Permutation Importance help verify whether a feature is truly useful for prediction.
- And tree-based importance scores like Gain, Cover, and Total Gain give powerful insights directly from the model structure.
By combining these techniques, we can evaluate features from multiple angles, leading to a more reliable and well-rounded ranking.
Now, let’s get into how to actually use these methods in practice.
Each method needs a backbone model to calculate feature importance. In this example, I’m using XGBoost — one of the most powerful and efficient ML models available today.
However, there’s a small catch.
⚠️ If we just use the default hyperparameters in XGBoost, the feature importance scores might not be reliable.
That’s why, before running any ranking method, I always do a basic hyperparameter tuning to get a reasonably good and general setup for the dataset.
I usually run around 25–50 trials, which is enough to improve performance without overfitting to the tuning dataset.
Once we’ve got all the individual feature rankings from each method (ranked from 1 to N), the final step is surprisingly simple:
👉 Just calculate the average rank of each feature across all methods — and voilà, we have our final, consolidated ranking!
Sounds easy, right? Because it is.
Here’s a sample code to demonstrate how to set things up: link
#FeatureSelection #MachineLearning #technique #WiDSVietnam #WiDSWorldwide
👍
2❤️
👍
💡
👏
😂
Explore More Posts
Hello, I'm a WiDS Ambassador for Ho Chi Minh city, Vietnam.
👋 Welcome to Your Local WiDS Group!We’re so glad you’re here! This space is your home base for connecting with others in your region — Ambassadors, volunteers, and community members who share your passion for data science and equity. 💬 Join the ConversationHead over to the Discussion tab to share updates, ask questions, and exchange ideas with others in your area. 👥 Meet Your MembersClick the Members tab to see who’s part of your group. Use the “Hosts” filter to find your local WiDS Ambassadors and connect directly. 📅 Explore & Share EventsVisit the Events tab to check out upcoming events — and if you’re a WiDS Ambassador, don’t forget to post your own! It’s a great way to find volunteers, speakers, and collaborators. 💡 Engage & CollaborateUse this space to swap best practices, share templates or resources, and build genuine connections. Please note: promotional content or product advertising is not allowed — let’s keep this space focused on learning, collaboration, and community impact. ✨ Each WiDS Ambassador event is independently organized as part of our shared mission to increase participation of women in data science and highlight outstanding women doing outstanding work.

🌟 VIETNAM ACHIEVES THE 1ST PLACE AT WiDS DATATHON 2025 🌟 🌟🎉 Congratulations to all teams who participated in the WiDS Datathon 2025! 🌍✨ We are especially proud of two outstanding teams from Vietnam who have achieved remarkable results: 🥇 Team Jena (Manh Nguyen & Thu Nguyen) - The 1st Place globally! 🏆 Team Quinn (Quynh Nguyen) - The Top First-Timer award! 🌍 The journey of WiDS Datathon 2025 has come to an end, marked by the efforts and dedication of all participating teams and the WiDS Hanoi & Ho Chi Minh City teams. ✨ See you all in the WiDS Datathon 2026 Journey! ✨ https://www.widsworldwide.org/get-inspired/blog/wids-global-datathon-2025-winners/


Comments
Start the Conversation
Good job! 🚀