optunity.solvers.TPE module

class optunity.solvers.TPE.TPE(num_evals=100, seed=None, **kwargs)[source]

Bases: optunity.solvers.util.Solver

This solver implements the Tree-structured Parzen Estimator, as described in [TPE2011]. This solver uses Hyperopt in the back-end and exposes the TPE estimator with uniform priors.

Please refer to Tree-structured Parzen Estimator for details about this algorithm.

[TPE2011]Bergstra, James S., et al. “Algorithms for hyper-parameter optimization.” Advances in Neural Information Processing Systems. 2011

Initialize the TPE solver.

Parameters:
  • num_evals (int) – number of permitted function evaluations
  • seed (double) – the random seed to be used
  • kwargs ({'name': [lb, ub], ..}) – box constraints for each hyperparameter
bounds
maximize(f, pmap=<built-in function map>)

Maximizes f.

Parameters:
  • f (callable) – the objective function
  • pmap (callable) – the map() function to use
Returns:

  • the arguments which optimize f
  • an optional solver report, can be None

minimize(f, pmap=<built-in function map>)

Minimizes f.

Parameters:
  • f (callable) – the objective function
  • pmap (callable) – the map() function to use
Returns:

  • the arguments which optimize f
  • an optional solver report, can be None

num_evals
optimize(f, maximize=True, pmap=<built-in function map>)[source]

Optimizes f.

Parameters:
  • f (callable) – the objective function
  • maximize (boolean) – do we want to maximizes?
  • pmap (callable) – the map() function to use
Returns:

  • the arguments which optimize f
  • an optional solver report, can be None

seed
static suggest_from_box(num_evals, **kwargs)[source]

Verify that we can effectively make a solver from box.

>>> s = TPE.suggest_from_box(30, x=[0, 1], y=[-1, 0], z=[-1, 1])
>>> solver = TPE(**s)