How to use gamultiobj for binary decision variables for features selection?
Show older comments
I want to use nsga2 for feature selection, where 1 represent feature is selcted while 0 represent that feature is not selected.
How can i use gamultiobj function for this?
7 Comments
Torsten
on 19 Jun 2025
"nsga2" already is a multi-objective optimization algorithm. Why do you need a second one ("gamultiobj") ?
Nainsi Gupta
on 19 Jun 2025
I found this one:
You can find several other implementations in MATLAB if you google "nsga2 & matlab".
I've no experience with these codes - so I cannot tell if they perform well and how they are used.
Are you asking whether gamultiobj() functions similarly to the NSGA-II algorithm, which is widely used for solving multi-objective optimization problems? Or, are you seeking alternatives for solving multi-objective optimization problems that specifically involve binary decision variables for feature selection?
If the latter is the case, it is possible to develop an intellectual approach that can be implemented using some of the built-in functions in MATLAB. In feature selection, where "1" indicates that a feature is selected and "0" indicates that a feature is unselected, the selection process must be aligned with the screening criteria.
For example, in a pool of 100 applicants, you may wish to select candidates aged 25 to 35. However, this is only one criterion. Additional criteria could include the number of years of experience in a specific field and the skill level (entry, mid, or senior) associated with the roles being considered.
X = randi([20, 50], [10, 10])
Nainsi Gupta
on 20 Jun 2025
Sam Chak
on 20 Jun 2025
@Nainsi Gupta, In that case, if you provide a small sample of data and describe how you would like a certain feature to be selected, experts in the fields of optimization and operations research can likely recommend appropriate built-in functions to address this problem.
Here are the MATLAB tools for multiobjective optimization. You will have to check by the mathematical description of the problems that can be solved whether the respective solver is suitable for your purpose or not.
Maybe we can help if you include the mathematical formulation of your optimization problem.
Answers (1)
Deepak
on 23 Jun 2025
1 vote
I understand that you are looking to use NSGA-II via "gamultiobj" function in MATLAB for binary feature selection, where each feature is represented by a 1 (selected) or 0 (not selected). To do this, you can set the option "PopulationType","bitstring" in optimoptions, which tells the solver to treat each individual as a binary vector. In your objective function, use this binary vector as a mask on your dataset to train a classifier (e.g., SVM), and return two objectives — typically classification error and number of selected features.
This approach allows "gamultiobj" to evolve a Pareto front of solutions that balance feature reduction and predictive performance. You can visualize the trade-off using "gaplotpareto", and select the best solution based on your preference. This method is recommended for binary feature selection tasks.
Please find attached the relevant documentations for reference:
Multiobjective Optimization: www.mathworks.com/discovery/multiobjective-optimization.html
gamultiobj: www.mathworks.com/help/gads/gamultiobj.html
I hope this helps.
Categories
Find more on Multiobjective Optimization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!