2

Given a Python callable that returns a fitness measurement (0.0=horrible, 0.5=ok, 1.0=perfect) and a description of its parameters (type=bool|int|float|nominal, min, max), what are robust implementations of parameter optimizers that can find the combination of parameters that get the fitness measure as high as possible? I'm not looking for an exhaustive guaranteed global optimum. An approximation would be fine.

I've seen scipy's optimize module referenced a lot, but also scikit-learn's gridsearch. What's the practical difference between these two? What are other options?

Cerin
  • 60,957
  • 96
  • 316
  • 522
  • i have used gridsearch a lot. are you looking to optimize the parameters of some components in your pipeline? for example gridsearch will allow you to create pipelines with feature selectors and classifiers. – AbtPst Nov 03 '15 at 17:12
  • @AbtPst, I have an image-processing pipeline, and for each image, I've manually set the parameters that give the optimal/desired output. Now I'm trying to find a single set of parameters that will work well for "most" images. I'm basically just trying to generalize my hand-tuned parameters. – Cerin Nov 03 '15 at 20:38
  • please take a look here http://stackoverflow.com/questions/33353228/feature-selection-using-logistic-regression/33422387?noredirect=1#comment54753653_33422387 – AbtPst Nov 03 '15 at 20:44
  • does my answer look like something you want? – AbtPst Nov 03 '15 at 20:44

1 Answers1

2

Given a parameter space and the task to find an optimum, gridsearch is probably the easiest thing you can do: Discretize the parameter space and just check all combinations by brute-force. Return the parameter combination that yielded the best result.

This works, but as you can imagine, this does not scale well. For high dimensional optimization problems this is simply not feasible.

Strategies to improve here depend on what additional information you have. In the optimal case you optimize a smooth and differentiable function. In this case you can use numerical optimization.

In numerical optimization routines you exploit the fact that the gradient of a function always points upward. So if you want to increase the function value, you simply follow the gradient a little bit and you will always improve, as long as the gradient is not zero.

This powerful concept is exploited in most of scipy's routines. This way you can optimize high-dimensional functions by exploiting additional information you get about the neighborhood of your current position.

So if you do not have a smooth and differential function, scipy's numerical routines cannot be used.

Note that exploiting the information in the neighborhood of your current parameter vector can be used in non-smooth optimization as well. Basically you do the same thing: You check a window around your current estimate and try to improve by finding a better value in that window.

cel
  • 30,017
  • 18
  • 97
  • 117