descend

package
v0.0.0-...-1bcdb33 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: Apache-2.0 Imports: 3 Imported by: 1

README

Evolutionary Strategy optimizer

Uses ES to optimize the parameters of arbitrary compute graphs.

Documentation

Overview

Package descend provides tools to use gradient descent to optimize the parameters of continuous functions implemented as tensorflow graphs. It does not (yet) implement backpropagation, but rather uses ES and other black box optimization algorithms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSeedSM

func NewSeedSM(s *op.Scope,
	noise NoiseFunc,
	paramDefs []ParamDef,
	numSeeds int,
) (
	makeSeedSM func(*tf.Session) (SeedSM, error),
	newBestSeed func(LossFunc) func(*tf.Session) (func() (int64, error), error),
	generation tf.Output,
	params []tf.Output,
)

NewSeedSM creates TF OPs for a state machine to move through parameter space according to the seed which is give and the generation. Use perturb and deperturb to move forward or rewind.

func NewWeightedSeedSM

func NewWeightedSeedSM(s *op.Scope,
	noise NoiseFunc,
	paramDefs []ParamDef,
	numSeeds int,
) (
	makeSeedSM func(*tf.Session) (WeightedSeedSM, error),
	newSeedWeights func(LossFunc, tf.Output) func(*tf.Session) (func() ([]float32, error), error),
	generation tf.Output,
	params []tf.Output,
)

NewWeightedSeedSM creates TF OPs for a state machine to move through parameter space according to the seed which is give and the generation. Use perturb and deperturb to move forward and rewind.

Types

type LossFunc

type LossFunc func(s *op.Scope, params []tf.Output) (loss tf.Output)

LossFunc takes a slice of params and returns the loss for the slice

type ModelDef

type ModelDef struct {
	Params []ParamDef // The list of shapes of params that the child wants.
	Loss   LossFunc   // Loss takes a slice of params, and returns a number which will be minimized.
}

ModelDef defines a model. Params describes the tensors of params which are to be optimised. Loss is a function which, when called, will create a sub graph which takes the params, and returns a loss value. Log takes params and generation, and returns a slice of operations to be pulled on.

type NoiseFunc

type NoiseFunc func(s *op.Scope, shape tf.Output, seed, gen tf.Output) tf.Output

NoiseFunc makes some deterministic noise.

func MakeNoise

func MakeNoise(stdevVal float32) NoiseFunc

MakeNoise creates a noise function

type ParamDef

type ParamDef struct {
	Name string                    // Name must be unique
	Init func(*op.Scope) tf.Output // Output of the initial state
}

ParamDef defines a shape and name

type SeedSM

type SeedSM struct {
	Generation int64
	Seeds      []int64
	// contains filtered or unexported fields
}

SeedSM allows one to move through the parameter space using seeds.

func (*SeedSM) Rewind

func (sm *SeedSM) Rewind() (err error)

Rewind steps back by one step,

func (*SeedSM) Step

func (sm *SeedSM) Step(seed int64) (err error)

Step moves the parameters through parameter space by one seed

type WeightedSeedSM

type WeightedSeedSM struct {
	Generation  int64
	SeedWeights [][]float32
	// contains filtered or unexported fields
}

WeightedSeedSM allows one to move through the parameter space using a list of seed weights.

func (*WeightedSeedSM) Step

func (sm *WeightedSeedSM) Step(weights []float32) (err error)

Step moves the parameters through parameter space by one list of weights

Directories

Path Synopsis
Package models provides functions to construct simple models.
Package models provides functions to construct simple models.

Jump to

Keyboard shortcuts

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