Trying to find minimum parameter values from a complex script.

Hello,
I've been pulling my hair out over this for months. I am a complete novice with Matlab, having learnt everything I know from help guides etc.
I have a script which inputs 7 parameters into a series of different calculations. Which calculations the script uses depends on the differing size of the parameters.
The calculation works out a predicted dataset for a set amount of intervals (I'm using 11 different values) based on the input parameters.
From this I compare the generated data to genuine data I have collected. With the aim of the script to loop until it finds the smallest difference between the two.
Straight forward right? Except I couldn't get fminsearch to work on the combination of calculations (as these differ every iteration).
So the workaround script I have written works, but is super clunky.
In addition, the 6 of the 7 parameters could vary from 0 to 1000 and I need them in intervals of 1. The way that I am currently running the script is to create an array of all the combination of parameters first, run through the script and then report back which combination of parameters in the array found the minimum difference between the generated data and the actual data. The mathmatics will already have identified that I'm struggling to get all the parameters into an array without 1000+GB of Ram.
I don't know enough about Mapping and Reducing, but I assume that might be the way to solve this, unless there is something really obvious I'm missing. Any help anyone can give would be super appreciated (and might stop me going bold).
Many thanks in advance.

4 Comments

Ok, the input-output relation between parameters and the predicted dataset does not sound to be differentiable because you wrote
Which calculations the script uses depends on the differing size of the parameters.
But I think it's worth trying an optimizer to best fit the parameters that correspond to your collected data.
What's the problem with fminsearch, lsqcurvefit, fmincon and the other tools suited for optimization ?
"Which calculations the script uses depends on the differing size of the parameters." This is a recipee for disaster for traditional optimization solvers such as fminsearch or lsqnonlin. Can you split your problem into exercising those ranges/calculations separately?
Also if you need the parameter values to be in intervals of 1, you might need to use an integer or mixed-integer solver, which would add a bit more complexity.
Hi Both,
Thankyou for your quick response. I think that is the conclusion I came to. To put a little more context to the situation, I'm using someone else's theoretical model of multisensory binding. The generated data is based on 2 stages of processing. Hense the calculations can't be split because they relate to one and other under the model itself.
Would it help if I shared my mess of a script?
The script won't help. You don't have a choice: either the optimization solver succeeds or not. Just test it out.
Maybe "ga" is the most suitable tool in your case to start with because of the possible "jumps" in your model equations.

Sign in to comment.

Answers (0)

Asked:

on 14 Dec 2022

Commented:

on 14 Dec 2022

Community Treasure Hunt

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

Start Hunting!