Question
how do i optimize weights of neural network using GA in MATLAB(need codes to achieve that), again how do i call this function that optimzes the neural network weights in GA GUI so i can work with it from the interface i need to train a neural network(a feedforward network and also a narx network) using genetic algorithm.and i need to do this by using GA to search for weights that will make the network learn very well.
Expert Answer
John Michell
PhD Expert
Answered Aug 13, 2026
When,
[ I N ] = size(input)
[ O N ] = size(target)
MSE00 = mean(var(target',1))% Reference MSE
The number of available training equations is
Ntrneq = N*O
For an I-H-O node topology the number of unknown weights is
Nw = (I+1)*H+(H+1)*O = (I+O+1)*H+1
Obviously,
1. The "3" in the GA input is replaced by I+O+1
2. The normalized mse calculation is
NMSE = mean((target(:)-output(:)).^2)/MSE00
Of course there will be more complications if the performance measure has to be decomposed into class and trn/val/tst subsets.
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related deep learning Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →