Documentation ¶
Overview ¶
Package oracle includes pre-defined oracles for picking parameter values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Func ¶
type Func func(previous []diviner.Trial, params diviner.Params, objective diviner.Objective, howmany int) ([]diviner.Values, error)
Func is an adapter type so that ordinary functions may be used as oracles.
type GridSearch ¶
type GridSearch struct{}
func (*GridSearch) Next ¶
func (_ *GridSearch) Next(previous []diviner.Trial, params diviner.Params, objective diviner.Objective, howmany int) ([]diviner.Values, error)
GridSearch is an oracle that performs grid searching [1]. It currently supports only discrete parameters, and returns errors if continuous parameters are encountered. GridSearch is deterministic, always returning parameters in the same order.
[1] https://en.wikipedia.org/wiki/Hyperparameter_optimization
type Random ¶
type Random struct { // Seed records the random seed that will be used to initialize random number generation for // the next point. It is exported so it can be serialized to preserve the oracle's state. Seed int64 // contains filtered or unexported fields }
Random is an oracle that returns random points in the search space. This is typically much more effective than grid search for most hyperparameter optimization problems. Currently, this oracle supports only integer and real parameter types.
type Skopt ¶
type Skopt struct { // BaseEstimator is the estimator used in by the oracle. It is one // of "GP" (default), "RF", "ET", "GBRT"; documented at // https://scikit-optimize.github.io/optimizer/index.html#skopt.optimizer.Optimizer BaseEstimator string // NumInitialPoints specifies the number of initialization // evaluations to perform before approximating the function using // the above estimator. NumInitialPoints int // AcquisitionFunc is the acquisition function that is used. One of // "gp_hedge" (default), "LCB", "EI", or "PI". See // https://scikit-optimize.github.io/optimizer/index.html#skopt.optimizer.Optimizer // for more details. AcquisitionFunc string // AcquisitionOptimizer is the method by which the acquisition // function is minimized. It is one of "sampling" or "lgbfs". By // default, the optimizer is selected automatically based on the // estimator and parameter space. AcquisitionOptimizer string }
Skopt is an oracle that uses scikit-optimize [1] to perform bayesian optimization. It works by calling into Python, and expects the environment to have a Python installation with scikit-optimize available. (It may be installed with "pip install scikit-optimize"). The parameters in the class are passed to skopt.Optimizer, which is documented at [2]. Default values are used for parameter's zero values, also defined at [2].
[1] https://scikit-optimize.github.io/ [2] https://scikit-optimize.github.io/optimizer/index.html#skopt.optimizer.Optimizer
TODO(marius): support passing in scikit-optimize's "random state" for determinism.
TODO(marius): figure out a better distribution mechanism, perhaps by bundling a PEX package or the like.
func (*Skopt) Next ¶
func (s *Skopt) Next(inputTrials []diviner.Trial, params diviner.Params, objective diviner.Objective, n int) ([]diviner.Values, error)
Next performs a single round of optimizations, yielding n trials. It fits a model based on the datapoints provided by the trials using the provided objective. This model is then used to select the next set of points by optimizing the configured acquisition function.