How to use ANN model as fitness function in genetic algorithm

13 views (last 30 days)
I am using ANN for modeling the reactive extraction efficiency of gallic acid. Now I want to optimize this model using GA, I am using the calling function 'optimtool', but after entering the fitness function and number of variables and running the silver, it shows 'Parameters.hiddenSizes contains negative value'.... I am not very proficient at all these, I have just started learning.. So somebody please help me in first identifying the correct fitness function to be called and secondly hobw to deal with this error, also in another problem, the error was "undefined function 'train' for input arguments of type double"... I am getting anything about this... Kindly help me out, I have little time left to complete it, any help would be appreciated
  1 Comment
Mpho Muloiwa
Mpho Muloiwa on 17 Jun 2021
Hi,
i am having a similar problem. i have checked in a number of forums with no luck. Let me know if you have a solution.

Sign in to comment.

Answers (1)

David Willingham
David Willingham on 18 Jun 2021
Hi Rihan,
Can I ask what in the model are you trying to optimize?
Typically Optimization is used to determine the optimal parameters of some fundamental equation that have a solution space that may not be completely bounded.
On the other hand ANN's are used to understand a solution space bounded by the historical data they are trained on.
It's for this reason ANN's, another technique called "Experimentation" is commonly used. This is where you setup an experiments which will run "trials" to tune, test or compare the network. For example:
  • Tune the hyperparams
  • Test different network types
  • Compare different input datasets
MATLAB's Experiment Manager App helps you setup and manage these types of experiments. It allows you to setup the range of the parameters you wish to sweep over or use Baysian Optimization to fine tune them.
Here are 2 videos that show how it works:
  1 Comment
Raihan Arfin
Raihan Arfin on 20 Jun 2021
Edited: Raihan Arfin on 20 Jun 2021
Thanks Sir for your response. I am actually trying to minimize the MSE of an ANN model using genetic algorithm. The problem that I am encountering is regarding defining the objective function. Since, I am not proficient in programming so I am not writing my own codes and using inbuilt tools. So if you could help me regarding this I will be really thankful to you.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!