V1Hyperopt

polyaxon._flow.matrix.hyperopt.V1Hyperopt()

Hyperopt is a search algorithm that is backed by the Hyperopt library to perform sequential model-based hyperparameter optimization.

the Hyperopt integration exposes 3 algorithms: tpe, rand, anneal.

  • Args:
    • kind: hyperopt
    • algorithm: str, one of tpe, rand, anneal
    • params: List[Dict[str, params]]
    • metric: V1OptimizationMetric
    • max_iterations: int, optional
    • concurrency: int, optional
    • num_runs: int, optional
    • seed: int, optional
    • tuner: V1Tuner, optional
    • early_stopping: List[EarlyStopping], optional

YAML usage

matrix:
  kind: hyperopt
  algorithm:
  maxIterations:
  metric:
  concurrency:
  params:
  numRuns:
  seed:
  tuner:
  earlyStopping:

Python usage

from polyaxon.schemas import (
    V1Hyperopt, V1HpLogSpace, V1HpUniform, V1FailureEarlyStopping, V1MetricEarlyStopping
)
matrix = V1Hyperopt(
  algorithm="tpe",
  num_runs=20,
  concurrency=2,
  seed=23,
  metric=V1OptimizationMetric(name="loss", optimization=V1Optimization.MINIMIZE),
  params={"param1": V1HpLogSpace(...), "param2": V1HpUniform(...), ... },
  early_stopping=[V1FailureEarlyStopping(...), V1MetricEarlyStopping(...)]
)

Fields

kind

The kind signals to the CLI, client, and other tools that this matrix is hyperopt.

If you are using the python client to create the mapping, this field is not required and is set by default.

matrix:
  kind: hyperopt

algorithm

The algorithm to use from the hyperopt library, the supported

  • algorithms: tpe, rand, anneal.
matrix:
  kind: hyperopt
  algorithm: anneal

concurrency

An optional value to set the number of concurrent operations.

This value only makes sense if less or equal to the total number of possible runs.
matrix:
  kind: hyperopt
  concurrency: 2

For more details about concurrency management, please check the concurrency section.

params

A dictionary of key -> value generator to generate the parameters.

To learn about all possible params generators.

The parameters generated will be validated against the component’s inputs/outputs definition to check that the values can be passed and have valid types.

matrix:
  kind: hyperopt
  params:
    param1:
       kind: ...
       value: ...
    param2:
       kind: ...
       value: ...

numRuns

Maximum number of runs to start based on the search space defined.

matrix:
  kind: hyperopt
  numRuns: 5

maxIterations

Maximum number of iterations to run the process of -> suggestions -> training ->\

matrix:
  kind: hyperopt
  maxIterations: 5

metric

The metric to optimize during the iterations, this is the metric that you want to maximize or minimize.

matrix:
  kind: hyperopt
  metric:
    name: loss
    optimization: minimize

seed

Since this algorithm uses random generators, if you want to control the seed for the random generator, you can pass a seed.

matrix:
 kind: hyperopt
 seed: 523

earlyStopping

A list of early stopping conditions to check for terminating all operations managed by the pipeline. If one of the early stopping conditions is met, a signal will be sent to terminate all running and pending operations.

matrix:
  kind: hyperopt
  earlyStopping: ...

tuner

The tuner reference (w/o component hub reference) to use. The component contains the logic for creating new suggestions based on hyperopt library, users can override this section to provide a different tuner component.

matrix:
  kind: hyperopt
  tuner:
    hubRef: 'acme/my-hyperopt-tuner:version'