# Deep Belief Networks (DBN) with IoT-Based Alzheimer's Disease Detection and Classification
## 3 Proposed System
### Maufty Optimization Algorithm
#### 3.5.3 Mating Procedure
Finally, the mayflies are ranked based on their classification performance, and the best new solutions are used to replace the worst solutions. The algorithm stops when the maximum number of iterations is reached or when a predetermined accuracy threshold is met. The proposed algorithm also includes visualizations of feature importance and/or saliency maps to help understand which parts of the brain are most important for classification and classification performance metrics such as accuracy and F1-score. Figure 5: Flowchart of MOA algorithm. ```
Inputs: - Dataset containing brain images (X) and corresponding labels (y) - Population size (N) - Maximum number of iterations (max_iter) Outputs: - Best set of features found (best_features)
1. Initialization: - Randomly select a subset of features to use for classification from the brain imagps - Initialize a population of N female mayflies with random positions and velocities for the selected subset of features - Initialize a population of male mayflies with random velocities for the selected subset of features
2. Feature selection and evaluation: - Evaluate the classification performance of each female mayfly using a classifier (e.g., SVM) and cross-validation on the selected subset of features - Set the global best solution (gbest) to be the female mayfly with the highest classification performance
3. While stopping criteria are not met do: Feature selection and evaluation: - Update the subset of features used for classification by selecting features based on the positions of the male mayflies using Equation (7) - Evaluate the classification performance of each female mayfly using the updated subset of features and the classifier - Update the positions and velocities of male and female mayflies using Equations (1)-(6) with the updated subset of features - Rank the mayflies: - Rank the female mayflies in order of classification performance from best to worst - Rate the mayflies: - Select pairs of female mayflies for mating using a tournament selection approach - Generate offspring using Equations (5) and (6) - Evaluate offspring: - Evaluate the classification performance of each offspring using the updated subset of features and the classifier - Separate offspring to male and female randomly: - For each offspring, randomly assign it to be a male or female mayfly - Replace worst solutions with the best new ones: - Replace the worst female mayflies with the best offspring, maintaining the population size of N - Update the global best solution (gbest) if a better solution is found - Update personal and global best solutions: - Update the personal best solution (gbest) for each female mayfly if it has a higher classification performance than its current pbest - Update the gbest if a better solution is found - Increment the iteration counter - End While - Return the best set of features found (best_features), which is the subset of features used by the female mayfly with the highest classification performance (gbest). ```  
**Algorithm 2****Mayfly Optimization Algorithm for AD detection and classification**  
Equations: - Equation (1): male_velocity = rand() * male_velocity + rand() * (gbest - position) - Equation (2): female_velocity = rand() * female_velocity + rand() * (gbest - position) - Equation (3): male_position = male_position + male_velocity - Equation (4): female_position = female_position + female_velocity - Equation (5): offspring_position = rand() * (female1_position - female2_position) + female2_position - Equation (6): offspring_velocity = rand() * (female1_velocity - female2_velocity) + female2_velocity - Equation (7): new_feature_set = select_features(male_position)