Back to godoc.org

Package cmaes

v0.7.1
Latest Go to latest

The highest tagged major version is .

Published: today | License: MIT | Module: github.com/c-bata/goptuna

Index

type Optimizer

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

Optimizer is CMA-ES stochastic optimizer class with ask-and-tell interface.

func NewOptimizer

func NewOptimizer(mean []float64, sigma float64, opts ...OptimizerOption) (*Optimizer, error)

NewOptimizer returns an optimizer object based on CMA-ES.

func (*Optimizer) Ask

func (o *Optimizer) Ask() ([]float64, error)

Ask a next parameter.

func (*Optimizer) Generation

func (o *Optimizer) Generation() int

Generation is incremented when a multivariate normal distribution is updated.

func (*Optimizer) PopulationSize

func (o *Optimizer) PopulationSize() int

PopulationSize returns the population size.

func (*Optimizer) ShouldStop

func (o *Optimizer) ShouldStop() bool

ShouldStop returns true when CMA-ES converged to local minimum or detecting divergent behavior.

func (*Optimizer) Tell

func (o *Optimizer) Tell(solutions []*Solution) error

Tell evaluation values.

type OptimizerOption

type OptimizerOption func(*Optimizer)

OptimizerOption is a type of the function to customizing CMA-ES.

func OptimizerOptionBounds

func OptimizerOptionBounds(bounds *mat.Dense) OptimizerOption

OptimizerOptionBounds sets the range of parameters.

func OptimizerOptionMaxReSampling

func OptimizerOptionMaxReSampling(n int) OptimizerOption

OptimizerOptionMaxReSampling sets a number of max re-sampling.

func OptimizerOptionPopulationSize

func OptimizerOptionPopulationSize(n int) OptimizerOption

OptimizerOptionPopulationSize sets population size.

func OptimizerOptionSeed

func OptimizerOptionSeed(seed int64) OptimizerOption

OptimizerOptionSeed sets seed number.

type Sampler

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

Sampler returns the next search points by using CMA-ES.

func NewSampler

func NewSampler(opts ...SamplerOption) *Sampler

NewSampler returns the TPE sampler.

func (*Sampler) SampleRelative

func (s *Sampler) SampleRelative(
	study *goptuna.Study,
	trial goptuna.FrozenTrial,
	searchSpace map[string]interface{},
) (map[string]float64, error)

SampleRelative samples multiple dimensional parameters in a given search space.

type SamplerOption

type SamplerOption func(sampler *Sampler)

SamplerOption is a type of the function to customizing CMA-ES sampler.

func SamplerOptionBIPop

func SamplerOptionBIPop(incPopSize int) SamplerOption

SamplerOptionBIPop enables restart CMA-ES with two interlaced restart strategies, one with an increasing population size and one with varying small population size. The argument is multiplier of population size before each restart and basically you should choose 2.

func SamplerOptionIPop

func SamplerOptionIPop(incPopSize int) SamplerOption

SamplerOptionIPop enables restart CMA-ES with increasing population size. The argument is multiplier of population size before each restart and basically you should choose 2. From the experiments in the IPOP-CMA-ES, it reveal similar performance for factors between 2 and 3.

func SamplerOptionInitialMean

func SamplerOptionInitialMean(mean map[string]float64) SamplerOption

SamplerOptionInitialMean sets the initial mean vectors.

func SamplerOptionInitialSigma

func SamplerOptionInitialSigma(sigma float64) SamplerOption

SamplerOptionInitialSigma sets the initial sigma.

func SamplerOptionNStartupTrials

func SamplerOptionNStartupTrials(nStartupTrials int) SamplerOption

SamplerOptionNStartupTrials sets the number of startup trials.

func SamplerOptionOptimizerOptions

func SamplerOptionOptimizerOptions(opts ...OptimizerOption) SamplerOption

SamplerOptionOptimizerOptions sets the options for Optimizer.

func SamplerOptionSeed

func SamplerOptionSeed(seed int64) SamplerOption

SamplerOptionSeed sets seed number.

type Solution

type Solution struct {
	// Params is a parameter transformed to N(m, σ^2 C) from Z.
	Params []float64
	// Value represents an evaluation value.
	Value float64
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier