neural_compressor.strategy.bayesian

The Bayesian tuning strategy.

Classes

BayesianTuneStrategy

The Bayesian tuning strategy.

TargetSpace

Holds the param-space coordinates (X) and target values (Y).

BayesianOptimization

The class for bayesian optimization.

Functions

acq_max(ac, gp, y_max, bounds, random_seed[, ...])

Find the maximum of the acquisition function parameters.

Module Contents

class neural_compressor.strategy.bayesian.BayesianTuneStrategy(model, conf, q_dataloader=None, q_func=None, eval_func=None, eval_dataloader=None, eval_metric=None, resume=None, q_hooks=None)[source]

The Bayesian tuning strategy.

neural_compressor.strategy.bayesian.acq_max(ac, gp, y_max, bounds, random_seed, n_warmup=10000, n_iter=10)[source]

Find the maximum of the acquisition function parameters.

Parameters:
  • ac – The acquisition function object that return its point-wise value.

  • gp – A gaussian process fitted to the relevant data.

  • y_max – The current maximum known value of the target function.

  • bounds – The variables bounds to limit the search of the acq max.

  • random_seed – instance of np.RandomState random number generator

  • n_warmup – number of times to randomly sample the acquisition function

  • n_iter – number of times to run scipy.minimize

Returns:

The arg max of the acquisition function.

Return type:

x_max

class neural_compressor.strategy.bayesian.TargetSpace(pbounds, random_seed=9527)[source]

Holds the param-space coordinates (X) and target values (Y).

Allows for constant-time appends while ensuring no duplicates are added.

class neural_compressor.strategy.bayesian.BayesianOptimization(pbounds, random_seed=9527, verbose=2)[source]

The class for bayesian optimization.

This class takes the parameters bounds in order to find which values for the parameters yield the maximum value using bayesian optimization.