1

Not sure this is the right place to ask. Lets say there is a function f() where its implementation is unknown but it returns a score. I would like to get the highest possible score by modifying the input parameters. I also try to be better than brute force (finding all possible combination of input parameters, if that is even possible)

I do know that

  • f() runs an algorithm against a known dataset. The algorithm is tweaked by the input parameters.
  • f() needs 6 parameters
  • I know the type of each parameter (int, float, boolean)
  • I know the range of each parameter i.e [-1,5](int), [0,1](float, percentage, i.e 0.5 = 50%)
  • Some parameters have an open range i.e >1 (int)
  • Some are dependent of each other. i.e min and max parameter. That is min < max.

Any good pointers to algorithms that could help me solve that would be highly appreciated.

Chris
  • 155
  • 4

1 Answers1

1

In this kind of optimization problem a genetic algorithm is often a good approach, assuming computing the value of f() is not too costly.

The idea is to represent the 6 parameters as "genes". In the first generation their values are assigned randomly, then each "individual" in the generation (combination of parameters) is evaluated (i.e. calculate f), and the top performing "individuals" are selected. The next generation is obtained by cross-over and random mutation, and the process is repeated until f converges to a maximum.

Erwan
  • 25,321
  • 3
  • 14
  • 35
  • Thanks @Erwan . Interesting approach indeed. f() cost is mainly time as it takes about 5-10 seconds to compute. Do you maybe know some library for python? I did find tpot but it seems to be used for ML algorithms – Chris Feb 08 '21 at 12:55
  • @Chris I don't know any python library but I can see that searching "python genetic search" returns many results which seem relevant. In the past I implemented my own genetic algorithm, it's not very complex and this way I can control everything. – Erwan Feb 08 '21 at 17:22
  • the difficulty I have is how to find top performing individuals since f() is a blackbox function. – Chris Feb 08 '21 at 19:12
  • @Chris in this context an individual is an assignment of all 6 parameters. If you have the values of the 6 parameters you can calculate f, right? – Erwan Feb 10 '21 at 11:07
  • yes correct. I get a score if I have all 6 parameters. So if I do a batch with random assignment then I pick the most performing set of parameters and do the cross-over and random mutation? – Chris Feb 10 '21 at 18:32