tpe

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2019 License: MIT Imports: 7 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultGamma

func DefaultGamma(x int) int

DefaultGamma is a default gamma function.

func DefaultWeights

func DefaultWeights(x int) []float64

DefaultWeights is a default weights function.

func HyperoptDefaultGamma

func HyperoptDefaultGamma(x int) int

HyperoptDefaultGamma is a default gamma function of Hyperopt.

Types

type FuncGamma

type FuncGamma func(int) int

FuncGamma is a type of gamma function.

type FuncWeights

type FuncWeights func(int) []float64

FuncWeights is a type of weights function.

type ParzenEstimator

type ParzenEstimator struct {
	Weights []float64
	Mus     []float64
	Sigmas  []float64
}

ParzenEstimator is a surrogate model for TPE>

func NewParzenEstimator

func NewParzenEstimator(mus []float64, low, high float64, params ParzenEstimatorParams) *ParzenEstimator

NewParzenEstimator returns the parzen estimator object.

type ParzenEstimatorParams

type ParzenEstimatorParams struct {
	ConsiderPrior     bool
	ConsiderMagicClip bool
	ConsiderEndpoints bool
	Weights           FuncWeights
	PriorWeight       float64 // optional
}

ParzenEstimatorParams holds the parameters of ParzenEstimator

type Sampler

type Sampler struct {
	// contains filtered or unexported fields
}

Sampler returns the next search points by using TPE.

func NewSampler

func NewSampler(opts ...SamplerOption) *Sampler

NewSampler returns the TPE sampler.

func (*Sampler) Sample

func (s *Sampler) Sample(
	study *goptuna.Study,
	trial goptuna.FrozenTrial,
	paramName string,
	paramDistribution interface{},
) (float64, error)

Sample a parameter for a given distribution.

type SamplerOption

type SamplerOption func(sampler *Sampler)

SamplerOption is a type of the function to customizing TPE sampler.

func SamplerOptionGammaFunc

func SamplerOptionGammaFunc(gamma FuncGamma) SamplerOption

SamplerOptionGammaFunc sets the gamma function.

func SamplerOptionNumberOfEICandidates

func SamplerOptionNumberOfEICandidates(n int) SamplerOption

SamplerOptionNumberOfEICandidates sets the number of EI candidates (default 24).

func SamplerOptionNumberOfStartupTrials

func SamplerOptionNumberOfStartupTrials(n int) SamplerOption

SamplerOptionNumberOfStartupTrials sets the number of start up trials (default 10).

func SamplerOptionParzenEstimatorParams

func SamplerOptionParzenEstimatorParams(params ParzenEstimatorParams) SamplerOption

SamplerOptionParzenEstimatorParams sets the parameter of ParzenEstimator.

func SamplerOptionSeed

func SamplerOptionSeed(seed int64) SamplerOption

SamplerOptionSeed sets seed number.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL