QHyper.optimizers#

This module contains implementations of different optimizers. Some of the optimizers are written from scratch based on popular algorithms, while others are just a wrapper for existing solutions. No optimizer is imported by deafult to reduce number of dependencies. To use any optimizer you can import it directly like

from QHyper.optimizers.random import Random

or use function Optimizers.get() with the name of the optimizer. Any optimizer that is in directory ‘QHyper/custom’ or ‘custom’ will be also available in this function.

Optimization result dataclass

OptimizationResult(value, params[, history])

Dataclass for storing the results of an optimization run.

OptimizationParameter([min, max, step, init])

Dataclass for storing bounds, steps and init values for parameters that might be optimized.

Interface

Optimizer()

Base class for Optimizer.

Available optimizers

scipy_minimizer.ScipyOptimizer([verbose, ...])

Class for the SciPy minimizer.

qml_gradient_descent.QmlGradientDescent([...])

Gradient Descent Optimizer

cem.CEM([verbose, disable_tqdm, epochs, ...])

Implementation of the Cross Entropy Method for hyperparameter tuning

random.Random([verbose, disable_tqdm, ...])

Random optimizer

grid_search.GridSearch([verbose, ...])

Grid search optimizer

dummy.Dummy()

Dummy optimizer.

Additional functions

class Optimizers[source]#
static get(name)[source]#

Get Optimizer class by name.

The optimizer will be available by the ‘name’ attribute if defined or by the class name. Letters case doesn’t matter.

Return type:

Type[Optimizer]