 Research
 Open Access
Hybrid Bacterial Foraging and Particle Swarm Optimization for detecting Bundle Branch Block
 Padmavathi Kora^{1}Email authorView ORCID ID profile and
 Sri Ramakrishna Kalva^{1, 2}
 Received: 7 April 2015
 Accepted: 12 August 2015
 Published: 4 September 2015
Abstract
Abnormal cardiac beat identification is a key process in the detection of heart diseases. Our present study describes a procedure for the detection of left and right bundle branch block (LBBB and RBBB) Electrocardiogram (ECG) patterns. The electrical impulses that control the cardiac beat face difficulty in moving inside the heart. This problem is termed as bundle branch block (BBB). BBB makes it harder for the heart to pump blood effectively through the heart circulatory system. ECG feature extraction is a key process in detecting heart ailments. Our present study comes up with a hybrid method combining two heuristic optimization methods: Bacterial Forging Optimization (BFO) and Particle Swarm Optimization (PSO) for the feature selection of ECG signals. One of the major controlling forces of BFO algorithm is the chemotactic movement of a bacterium that models a test solution. The chemotaxis process of the BFO depends on random search directions which may lead to a delay in achieving the global optimum solution. The hybrid technique: Bacterial Forging–Particle Swarm Optimization (BFPSO) incorporates the concepts from BFO and PSO and it creates individuals in a new generation. This BFPSO method performs local search through the chemotactic movement of BFO and the global search over the entire search domain is accomplished by a PSO operator. The BFPSO feature values are given as the input for the Levenberg–Marquardt Neural Network classifier.
Keywords
 Bundle branch block
 BFO
 PSO
 BFPSO
 LM NN classifier
Background
Heart diseases are the most important cause of human mortality globally. Every year, 9.4 million deaths are attributed to heart diseases. This includes 51 % of deaths due to strokes and 45 % of deaths due to coronary heart diseases. Most of the cardiac diseases are caused due to the risk factors such as unhealthy diet, high blood pressure, tobacco usage, obesity, diabetes and physical inactivity.

Increased QRS complex duration ( >0.12 s).

Increased Q wave amplitude.

Abnormal T wave.

Increased QRS complex duration ( >0.12 s).

RSR’ format.

T wave inversion.
The diagnoses of BBB with the help of ECG consists of three main stages: preprocessing, feature extraction and classification. The first step in preprocessing focuses on the noise removal using filters. The second stage in preprocessing is segmentation which separates ECG files into beats. The samples that are extracted from each beat contains non uniform samples. The non uniform samples in each beat are converted into uniform samples of size 200 by using a technique called resampling. The resampled ECG beat is shown in Fig. 1. The next stage in BBB is the feature extraction. In this paper, Bacterial Foraging–Particle Swarm Optimization (BFPSO) technique is used as a feature extraction (optimization) method. It belongs to the family of swarm based optimization techniques. Swarm based algorithms have gained increased attention of the scientists and engineers in solving several engineering problems which can not be solved by traditional gradient based methods. The feature selection of ECG is very difficult to arrive at statistically. A large number of swarm based methods have been used in order to solve a few engineering problems like Genetic Algorithm (GA) Back (1996), Particle Swarm Optimization (PSO) Kennedy and Eberhart (1995), Bacterial Foraging Optimization (BFO) (Passino 2002; Liu and Passino 2002; Ahmad et al. 2014) etc.
BFO has poor convergence behavior over the other naturally inspired optimization algorithms because it (BFO) follows the local search through a random search process (chemotaxtic). Its overall performance depends more on the growth of search space dimensionality. BFO has very few successful engineering applications in optimal control engineering (Mishra and Bhende 2007), harmonic estimation theory (Mishra 2005), transmission path loss reduction (Tripathy et al. 2006; Tripathy and Mishra 2007), machine learning optimization (Cho et al. 2007) and so on.
PSO (Eberhart and Kennedy 1995) is a swarm based optimization algorithm and it takes inspiration from a group of birds or a group of fish etc. It has an advantage of high convergence speed as it finds the global optimum point using gbest, pbest values. However, the disadvantage of PSO is that, it gets trapped into the local minimum.
In this paper, a novel hybrid optimization method concurrently combines the BFO (Tang et al. 2006) with the PSO. The proposed hybrid algorithm fulfills the local search by using Chemotactic operation of BFO whereas the global search is accomplished by a PSO operator. Using this combination, it maintains a balance between ‘exploration’ and ‘exploitation’ and enjoys the best of both the algorithms, BFO and PSO (AbdElazim and Ali 2013). The proposed BFPSO method has been used in order to solve a few engineering problems (Dasgupta et al. 2009; Datta and Misra 2008; Biswas et al. 2007). BFPSO has been compared with the normal GA, PSO and BFO. The following comparative measures has been used to study the (1) Accuracy of the final solution (2) Convergence speed. Such comparison shows the superiority of the proposed algorithm over the traditional methods. This algorithm outperforms both PSO and BFO over a few ECG benchmark data sets for the classification of ECG.
Pre processing
Data collection
MITBIH record numbers
Record  NB  LBBB  RBBB 

100  2237  0  0 
101  1858  0  0 
103  2080  0  0 
106  1505  0  0 
109  0  2490  0 
111  0  2121  0 
118  0  0  2164 
123  1513  0  0 
124  0  0  1529 
207  0  1457  85 
To prove the performance of BFPSO, the usual MIT BIH arrhythmia database (Goldberger et al. 2000) is considered. The data used in this algorithm confines to 11 recordings that consists of 5 normal, 3 LBBB and 3 RBBB for a duration of 60 min at 360 Hz sampling rate. The file numbers of 11 recordings for normal and BBB are shown in Table 1.
Noise removal
R peak detection and beat segmentation of ECG
Distance between two R peaks is called RR interval as depicted in Fig. 6. 2/3 rds of the RR interval samples to the right of R peak and 1/3 rds of the RR interval samples to the left of R peak were considered as one beat as in Fig. 7. Each beat after segmentation was resampled to 200 samples.
Feature extraction of ECG signal
Genetic algorithm (GA)
Genetic algorithm (Goldberg and David 1989) simulates the process of evolution in nature. The methods of GA can be applied to solve many realworld problems. Genetic algorithms allow each successive generation of solutions to evolve from the previous generation’s strengths. GA is an adaptive heuristic method for searching the global optimum point. It maps the search space into a genetic space. That is, every possible key is encoded with a vector called chromosome. Each element of the chromosome represents a gene. All the chromosomes make up a population. The strength of the population is estimated according to the fitness function. The fitness function is used to measure the fitness of each chromosome.

Reproduction.

Crossover.

Mutation.
Reproduction Reproduction is based on the Darwinian theory of “Survival of the fittest”. GA eliminates the population of low fitness and keeps the population of high fitness. This whole process is repeated, and the population of high fitness move to the next generation until a good population (individuals) is found.
Cross over In cross over process, two parents are selected from good individuals and are used to produce a new offspring. The process of crossover continues for a fixed number of iterations or until a termination condition is satisfied.
Mutation It introduces new features in the offspring that is completely different from their forerunners. Hence mutation inherently introduces genetic diversity in the present population.
The main objective of genetic feature selection stage is to reduce the dimensionality (Raymer et al. 2000) of the problem before the supervised neural network classification process. GA, which solves the optimization problems using the methods of evolution, has proved to be a promising one. GA evaluates each individual’s fitness as well as the quality of the solution. The fittest individuals are more eligible to enter the next generation as a population. After a required number of generations, the final set of optimal population with the fittest chromosomes will emerge. The process of selection, crossover and mutation continues for a fixed number of generations or till a termination condition is satisfied. Genetic algorithms have been used for selecting the optimal subspace in which the projected data gives higher recognition accuracy.
Particle Swarm Optimization (PSO)
The basic idea behind PSO Eberhart and Kennedy (1995) is, accelerating each particle in search space towards the gbest and the pbest values, at each step with the random acceleration as shown in Fig. 8.
Bacterial Foraging Optimization (BFO)
In the year 2002, BFO was developed by the researcher Passino (2002), Liu and Passino (2002) which relies on a selection procedure that get rid of the bacterium with poor search methods. Several generations with poor foraging methods are eliminated whereas only the organisms with good search strategy survive signifying the “survival of the fittest”.
Bacterial foraging activity of “E. coli” bacteria (Tang et al. 2006) is used as the inspiration for extracting (optimizing) the features of ECG. Feature selection may be a international optimization problem in machine learning, that optimize/reduce the number of features, redundant and noisy features, removes unsuitable features, this leads to acceptable accuracy.
 (a)
Chemotaxis
 (b)
Swarming
 (c)
Reproduction
 (a)Chemotaxis: The random walk of E. coli bacterium can be explained in two steps
 (1)
Swimming.
 (2)
Tumbling.
Basically the E. coli bacteria will move in two alternative ways. It will swim for a specific amount of time in one direction then it is going to tumble (change direction). It will alternate between these two modes of operation for its entire life period. Say x(i) represents ith bacteria and C, the step size taken within the random direction specified by the swim length. In the process of chemotaxis the x(i+1) of the bacteria could also be given bywhere ‘\(Del\) ’ is a random vector \(\epsilon\) (−1,1). The simulated chemotactic movement of an E. coli bacterium may be viewed as a random hill climbing.$$\begin{aligned} x(i+1)=x(i)+C(i)\frac{Del(i)}{Del(i)Del^{T}(i)} \end{aligned}$$(3)
 (1)
 (b)Swarming In E. coli bacteria swarm behavior is observed like in several other species, where the complex and stable spaciotemporal groups are formed in a semisolid nutrient medium. The E. coli forms themselves like a traveling ring and moving down towards the nutrient food. The E. coli bacteria releases an attractant, aspartate when its cells are excited by a high level of succinate. This helps them to arrange into groups and thus they move as coaxial patterns of groups with high density. The cellcell signaling in E. coli swarm may be calculated by the following Rosenbrock function.where d is the dimension and x(i) is the ith bacterium.$$\begin{aligned} \sum _{i=1}^{d1}[100(x_{i+1}x_{i}^2)^2+(x_{i}1)^2] \end{aligned}$$(4)
 (c)
Reproduction The unhealthy bacteria finally die while the remaining healthier bacteria (those giving higher value of the cost value) asexually split into two bacteria, and they are placed in their respective positions. So the total size of the bacteria swarm remains constant.
The complete pseudo code and flowchart for feature optimization using BFO is given below Fig. 9.
Bacterial Foraging Particle Swarm Optimization algorithm (BFPSO)
 1.
Global search through the PSO operator followed by
 2.
Local search through the BFO (chemotaxis) which fine tunes the solution.
 1.
Algorithm is not be trapped into the local minimum.
 2.
Convergence speed will be increased.
After a specified number of complete swims, the resulting solution is stored in the descending order. A detailed description of the complete algorithm can be traced in Fig. 10.
In the present approach, after undergoing a chemotactic step, each bacterium also gets mutated by a PSO operator. In this step, each bacterium is stochastically attracted towards the gbest position and the local search in different regions is taken care of by the BFO (chemotaxis step) algorithm.
The main objective of BFPSO feature selection stage is to reduce the features of the problem before the supervised neural network classification. In all the wrapper algorithms used, BFPSO solves optimization problems using the methods of evolution and has emerged as a promising one.
Classification of BFPSO features
The extracted features (20 features) from BFPSO algorithm are classified using different types of classification techniques such as KNN, SVM, Neural Network classifiers.
Levenberg–Marquardt neural network (LM NN)
In this work for the detection of BBB, back propagation Levenberg–Marquardt neural network (LMNN) (Ibn Ibrahimy et al. 2013) is used. This NN provides rapid execution of the network to be trained, which is the main advantage in the neural signal processing applications Sapna et al. (2012).
The NN was designed to work well if it was built with 20 input neurons, 10 neurons in the hidden layer and 3 neurons in the output layer.
The performance of this algorithm is compared with Scalar Conjugate Gradient (SCG) NN. The LMNN algorithm is a robust and a very simple method for approximating a function. SCG NN method provides conjugate directions of search instead of performing a linear search. The network is trained with 1800 ECG beats, and tested with 1006 ECG beats. The total number of iterations are set to 1000 and mean square error less than 0.001. The main advantage of this algorithm is that the time required to train the network is less.
Results
ECG features before optimization = [1 2 3 .........200];
The optimized ECG features (20 features) using BFPSO algorithm are given below
Optimized features (column numbers) using BFPSO = [67 68 66 69 65 70 71 64 72 63 73 62 74 61 60 75 59 76 58 77];
These reduced features are given as an input to the Neural Network so that its convergence speed and final accuracy can be increased.

Count of Normal beats used for classification: 9193.

Count of RBBB beats user for classification: 3778.

Count of LBBB beats user for classification: 6068.

Total number of beats used for classification: 19,039.

Count of correctly classified beats: 18,800.

Total misclassified beats: 239.

TP(True_Positive) = Count of all the correctly classified Normal beats.

TN(True_Negative) = Count of all beats the correctly classified Abnormal beats.

FP(False_Positive) = Count of Normal beats which are classified as Abnormal.

FN(False_Negative) = Count of Abnormal beats which are classified as Normal.
Classification with KNN classifier
Classifier  Sensi (%)  Speci (%)  Accuracy (%) 

PSO+KNN  52.5  53.2  65.1 
GA+KNN  63.5  67.86  64.55 
BFO+KNN  53.5  52.2  53.22 
BFPSO+KNN  52.35  53.9  52.17 
Classification with SVM classifier
Classifier  Sensi (%)  Speci (%)  Accuracy (%) 

PSO+SVM  71.0  73.13  70.12 
GA+SVM  87.87  82.85  84.62 
BFO+SVM  76.2  75.47  72.13 
BFPSO+SVM  75.5  76.9  76.74 
Classification with SCG NN classifier
Classifier  Sensi (%)  Speci (%)  Accuracy (%) 

PSO+SCG NN  86.1  85.3  86.0 
GA+SCG NN  67.87  82.85  84.62 
BFO+SCG NN  88.2  87.2  87.9 
BFPSO+SCG NN  84.42  82.28  83.13 
Classification with LM NN classifier
Classifier  Sensi (%)  Speci (%)  Accuracy (%) 

BFO+LM NN  93.34.2  92.2  93.9 
PSO+LM NN  91.2  89.2  80.9 
GA+ LM NN  95.4  96.2  96.5 
BFPSO+LM NN  98.97  98.7  98.1 
Overall classification accuracy with BFPSO features
Classifier  LBBB (%)  RBBB (%)  Normal (%) 

KNN  55.2  54.2  52.17 
SVM  76.1  75.3  76.74 
SCG NN  84.42  82.28  83.13 
LM NN  98.2  98.15  98.1 
Receiver operating characteristic (ROC) curve is plotted for true positive rate (Sensitivity) verses false positive rate (100Specificity) as in Fig. 13. Each point on the ROC performance curve represents a sensitivity/specificity pair corresponding to a particular parameter. The normal and abnormal classes can be clearly distinguished using the measure of the area under the curve.
Discussion and conclusion
Early changes of BBB are important because immediate treatment can save the life of the patient from heart failure. There are several methods to detect features of BBB. The RR interval, P wave, statistical methods for feature extraction have some limitations. Accurate detection of features is important for detection of BBB. Natureinspired algorithms have gained increased attention of scientists and engineers in solving the problems which cannot be solved by the above traditional methods. In our approach, BFPSO features for each ECG beat (BBB, normal) are extracted and the results show that accuracy for the detection of BBB has increased.
In the present study we have developed a simple computational model for the detection of BBB using the BFPSO algorithm. The BFPSO algorithm has been compared with the GA, BFO and PSO. In our study we observed: (1) accuracy, (2) frequency of hitting the optimal point (3) convergence speed. The BFPSO algorithm provides better classification results compared to the original BFO, PSO and GA for all the ECG data. Thus, this optimization method that we have applied may useful for further such investigations.
Declarations
Authors’ contributions
PK involved in the ECG data collection, Preprocessing. Dr. SRK explained the BFPSO algorithm concept, classification methods of ECG features and given the design flow for preparing the rough draft of the manuscript. Then PK prepared Matlab coding for these concepts. Dr. SRK also corrected the syntax and grammar mistakes in the final prepared manuscript. Both authors read and approved the final manuscript.
Acknowledgements
The authors would like to thank the anonymous reviewers for their comments and suggestions that helped to improve the quality of this paper.
Compliance with ethical guidelines
Competing interests The authors declare that they have no competing interests.
Open AccessThis article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.
Authors’ Affiliations
References
 AbdElazim SM, Ali ES (2013) A hybrid particle swarm optimization and bacterial foraging for optimal power system stabilizers design. Int J Electr Power Energy Syst 46:334–341View ArticleGoogle Scholar
 Back T (1996) Evolutionary algorithms in theory and practice: Evolution strategies, evol. programming. In: Proceedings of Genetic Algorithms. Oxford Univ. Press, LondonGoogle Scholar
 Biswas A, Dasgupta S, Das S, Abraham A (2007) Synergy of PSO and bacterial foraging optimization a comparative study on numerical benchmarks. Innovations in Hybrid Intelligent Systems. Springer, Berlin Heidelberg, pp 255–263View ArticleGoogle Scholar
 Cho JH, Chun MG, Lee DJ (2007) Parameter optimization of extreme learning machine using bacterial foraging algorithm. In: International symposium on advanced intelligent systems, pp 742–747Google Scholar
 Dasgupta S, Das S, Abraham A (2009) Adaptive computational chemotaxis in bacterial foraging optimization: an analysis. IEEE Trans Evolut Comput 13(4):919–941Google Scholar
 Datta T, Misra IS (2008) Improved adaptive bacteria foraging algorithm in optimization of antenna array for faster convergence. Prog Electromagn Res C 1:143–157View ArticleGoogle Scholar
 Eberhart RC, Kennedy J (1995) A new optimizer using particle swarm theory. In: Proceedings of ISMMH S, pp 39–43Google Scholar
 Goldberg David E (1989) Genetic Algorithms in search. Optimization and machine learning. Kluwer Academic Publishers, BostonGoogle Scholar
 Goldberger AL, Amaral LA, Glass L, Hausdorff JM, Ivanov PC, Mark RG, Stanley HE (2000) Physiobank, physiotoolkit, and physionet components of a new research resource for complex physiologic signals. Circulation 101(23):e215–e220View ArticleGoogle Scholar
 Ibn Ibrahimy M, Ahsan R, Khalifa OO (2013) Design and optimization of Levenberg–Marquardt based neural network classifier for emg signals to identify hand motions. Meas Sci Rev 13(3):142–151View ArticleGoogle Scholar
 Kennedy J, Eberhart R (1995) Particle swarm optimization. In: Proceedings of IEEE International Conference Neural Network, pp 1942–1948Google Scholar
 Liu Y, Passino KM (2002) Biomimicry of social foraging bacteria for distributed optimization: models, principles, and emergent behaviors. J Optim Theory Appl 115(3):603–628View ArticleGoogle Scholar
 Melgani F, Bazi Y (2008) Classification of Electrocardiogram Signals With Support Vector Machines and Particle Swarm Optimization. IEEE Trans Inf Technol Biomed 12(5):667–677View ArticleGoogle Scholar
 Mishra S (2005) A hybrid least squarefuzzy bacterial foraging strategy for harmonic estimation. IEEE Trans Evol Comput 9(1):61–73View ArticleGoogle Scholar
 Mishra S, Bhende CN (2007) Bacterial foraging techniquebased optimized active power filter for load compensation. IEEE Trans Power Deliv 22(1):457–465View ArticleGoogle Scholar
 Nasir ANK, Tokhi MO, Ghani NMA (2014) Novel adaptive bacteria foraging algorithms for global optimization. Appl Comput Intell Soft Comput 2014:1–7. doi:10.1155/2014/494271 View ArticleGoogle Scholar
 Passino KM (2002) Biomimicry of bacterial foraging for distributed optimization and control. IEEE Control Syst Mag 22(3):52–67View ArticleGoogle Scholar
 Raymer ML, Punch WF, Goodman ED, Kuhn LA (2000) Dimensionality reduction using genetic algorithms. IEEE Trans Evolut Comput 4(2):164–171View ArticleGoogle Scholar
 Sapna S, Tamilarasi A, Kumar MP (2012) Backpropagation learning algorithm based on Levenberg–Marquardt algorithm. Comput Sci Inf Technol 2012:393–398Google Scholar
 Tang WJ, Wu QH, Saunders JR (2006) A novel model for bacteria foraging in varying environments. In: Proceedings of ICCSA, LNCS, vol 3980, pp 556–565Google Scholar
 Tripathy M, Mishra S (2007) Bacteria foragingbased to optimize both real power loss and voltage stability limit. IEEE Trans Power Syst 22(1):240–248View ArticleGoogle Scholar
 Tripathy M, Mishra S, Lai LL, Zhang QP (2006) Transmission loss reduction based on FACTS and bacteria foraging algorithm. In: Proceedings of PPSN, pp 222–231Google Scholar