This repository contains MATLAB files (tested with version 2024b) for training Multilayer Perceptron (MLP) Neural Networks and optimizing these networks using Genetic Algorithms (GA), as described in code avaliability of the associated article. It is designed to allow the efficient and customizable creation, training, and optimization of MLPs.
To ensure proper functionality, all files must be in the same folder. The system has been tested on Windows 10 & 11, and the necessary input files for training and validation are included in the repository.
The repository contains two main MATLAB files:
1️⃣ RNACreator.m
This file is responsible for creating and training the Multilayer Perceptron (MLP) Neural Networks. The user can define the number of input variables, the number of neurons per layer (with a maximum of 3 layers), the desired accuracy criterion, and the maximum number of iterations (defined by the "Generation" parameter). The training continues until the specified accuracy criterion is met or the iteration limit is reached. Once training is complete, the networks are sent to the optimization phase in the GeneticALgorithm.m file.
2️⃣ GeneticAlgorithm.m
This file optimizes the networks trained using Genetic Algorithms (GA). The process includes operations such as selection, migration, crossover and mutation. By default, 30% of the best trained networks are selected, 20% will go to crossover and a mutation rate of 5% is applied to introduce variations in the networks, resulting in the migration which is the sum of these factors. The default loss function used is cross-entropy, but it can be manually modified by the user.
3️⃣ trainingPartitions.m
trainingPartitions.m is a build-in function in matlab used to separate the training and test data is a percentage that can be adjusted manually
The following input files are required for proper functionality:
Both input files must be in the same folder as the main MATLAB files.
The repository allows customization of several parameters, which can be adjusted directly in the RNACreator.m and GeneticAlgorithm.m files. The key configurations include:
Training with RNACreator.m: The user configures the number of input variables, network structure, accuracy criterion, and iteration limit. The system creates and trains the networks until the accuracy criterion is met or the iteration limit is reached.
Optimization with GeneticAlgorithm.m: The trained networks are optimized using Genetic Algorithms. The process applies selection, migration, crossover and mutation to generate more efficient networks. The percentages of selection (20%), mutation (5%) and migration (sum of the other factors) can be adjusted directly in the code.
This repository provides a complete solution for **training and optimizing MLP ANN **. The system allows customization of various parameters, from network structure to optimization operations. With the appropriate adjustments, users can explore network configurations that maximize model performance. The code has been tested on Windows 10 & 11, ensuring stability and compatibility.
For questions or suggestions, feel free to explore the code and adjust the configurations to fit your project's needs.