ReferenceTPE
OrchestrationMatrixTPE

V1TPE

polyaxon._flow.matrix.tpe.V1TPE()

Configure Polyaxon's Tree-structured Parzen Estimator search.

TPE uses completed trials to learn which parts of the search space are more promising. It separates better and worse observations, fits a probability model for each parameter in both groups, and selects values favored by the better model. The first trials use random sampling to collect enough observations.

Unlike grid and random search, later TPE suggestions depend on the metric history from earlier trials.

  • Args:
    • kind: tpe
    • 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: tpe
  maxIterations:
  metric:
  concurrency:
  params:
  numRuns:
  seed:
  tuner:
  earlyStopping:

Python usage

from polyaxon.schemas import (
    V1TPE, V1HpLogSpace, V1HpUniform, V1FailureEarlyStopping, V1MetricEarlyStopping
)
matrix = V1TPE(
  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 TPE.

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

matrix:
  kind: tpe

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: tpe
  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: tpe
  params:
    param1:
       kind: ...
       value: ...
    param2:
       kind: ...
       value: ...

numRuns

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

matrix:
  kind: tpe
  numRuns: 5

maxIterations

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

matrix:
  kind: tpe
  maxIterations: 5

metric

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

matrix:
  kind: tpe
  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: tpe
 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: tpe
  earlyStopping: ...

tuner

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

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