Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

B-MFO: Binary Moth-Flame Optimization for Feature Selection

MATLAB DOI

Usage and citation

This repository is provided for academic and research visibility. No open-source software license is currently granted. If you use or refer to this implementation in academic work, please cite the associated paper. For permission to reuse, modify, or redistribute the code, please contact the authors.

The included article is distributed under the Creative Commons Attribution 4.0 license stated in the paper.

MATLAB implementation of B-MFO, a binary Moth-Flame Optimization algorithm for wrapper-based feature selection. B-MFO converts continuous MFO search positions into binary feature-selection decisions through 12 transfer functions in three families: S-shaped, V-shaped, and U-shaped.

Associated paper

M. H. Nadimi-Shahraki, M. Banaie-Dezfouli, H. Zamani, S. Taghian, and S. Mirjalili, "B-MFO: A Binary Moth-Flame Optimization for Feature Selection from Medical Datasets," Computers, vol. 10, no. 11, article 136, 2021. https://doi.org/10.3390/computers10110136

The paper is open access: read the copy included in this repository or view the published article.

Algorithm overview

B-MFO represents a candidate feature subset as a binary vector. A value of 1 selects a feature and 0 excludes it. At each iteration, the algorithm:

  1. evaluates every moth using a wrapper-based classifier;
  2. ranks moths and retains the best solutions as flames;
  3. updates continuous moth positions using the MFO logarithmic spiral;
  4. maps the continuous positions to binary decisions using a selected transfer function; and
  5. reduces the number of active flames progressively to balance exploration and exploitation.

The computational complexity discussed in the paper is O(NDT), where N is the population size, D is the number of features, and T is the maximum number of iterations.

Transfer functions

Set transferFunctionID in Main.m to an integer from 1 to 12:

IDs Family Variants
1-4 S-shaped S1-S4
5-8 V-shaped V1-V4
9-12 U-shaped U1-U4

The supplied demonstration uses S2 (transferFunctionID = 2). The paper evaluates all 12 variants; the best variant depends on the dataset.

Repository contents

File Purpose
Main.m Configures and runs the demonstration
B_MFO.m Main B-MFO optimization procedure
Bstep_B_MFO.m Implements the 12 binary transfer functions
jFitnessFunction.m Demonstration wrapper fitness using 5-NN
ionosphere.mat Demonstration dataset (feat and label)
paper/B-MFO-paper.pdf Open-access copy of the associated article
CITATION.cff Machine-readable citation metadata

Requirements

  • MATLAB R2018a or later
  • Statistics and Machine Learning Toolbox (cvpartition, fitcknn, and predict)

The code was originally developed in MATLAB R2018a.

Quick start

  1. Download or clone this repository.
  2. Open the repository folder in MATLAB.
  3. Run:
Main

The script loads the included Ionosphere demonstration dataset, creates a stratified holdout partition, runs B-MFO, prints the best fitness at each iteration, and plots the convergence curve. The main outputs are:

  • sFeat: reduced dataset containing the selected features;
  • Sf: indices of the selected features;
  • Nf: number of selected features; and
  • curve: best fitness value at each iteration.

To use your own dataset, supply:

feat  % numeric matrix: rows = samples, columns = features
label % response vector: one label per sample

Then replace load ionosphere.mat in Main.m with your data-loading code.

Demo versus full paper experiments

This repository is a compact demonstration release. Its default settings are 10 moths, 100 iterations, one S2 transfer-function run, and a 20% stratified holdout evaluated by 5-NN classification error.

The published experimental protocol used 20 moths, 300 iterations, 30 independent runs, 10-fold cross-validation, seven medical datasets, and evaluation of all 12 transfer-function variants. Therefore, the default demo is intended to illustrate the implementation and may not reproduce the numerical tables in the paper directly.

Reproducibility

The algorithm is stochastic. For a repeatable demonstration, uncomment the rng(1,'twister') line in Main.m. For research comparisons, use multiple independent runs and report the mean and standard deviation.

Citation

If this code contributes to your research, please cite the associated article:

@article{NadimiShahraki2021BMFO,
  author  = {Nadimi-Shahraki, Mohammad H. and Banaie-Dezfouli, Mahdis and Zamani, Hoda and Taghian, Shokooh and Mirjalili, Seyedali},
  title   = {B-MFO: A Binary Moth-Flame Optimization for Feature Selection from Medical Datasets},
  journal = {Computers},
  volume  = {10},
  number  = {11},
  pages   = {136},
  year    = {2021},
  doi     = {10.3390/computers10110136}
}

Contact

Mahdis Banaie-Dezfouli
GitHub: MahdisBD
Email: mahdis.dezfouli@gmail.com

Corresponding author of the paper: Mohammad H. Nadimi-Shahraki (nadimi@iaun.ac.ir).

Usage and citation

This repository is provided for academic and research visibility. No open-source software license is currently granted. If you use or refer to this implementation in academic work, please cite the associated paper. For permission to reuse, modify, or redistribute the code, please contact the authors.

The included article is distributed under the Creative Commons Attribution 4.0 license stated in the paper.

About

MATLAB implementation of Binary Moth-Flame Optimization (B-MFO) for feature selection from medical datasets.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages