training

package
v0.0.0-...-32ffa8f Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2017 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BPTrainer

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

BPTrainer trains a network given a train set and a learning configuration. It also returns debug information to monitor the process

func NewBPTrainer

func NewBPTrainer(config LearningConfig, data *weight.PairSet, net weight.BPLearnerLayer, costFunction weight.BPCostFunc) *BPTrainer

NewBPTrainer creates a new BPTrainer

func (*BPTrainer) SetDebugger

func (t *BPTrainer) SetDebugger(debugger debug.NetDebugger)

SetDebugger sets the debugger to use during the train process

func (*BPTrainer) SetNumGoroutines

func (t *BPTrainer) SetNumGoroutines(nt int) error

SetNumGoroutines sets the number of parallel goroutines that will train a part of each batch independently

func (*BPTrainer) Test

func (t *BPTrainer) Test() (accuracy, loss float64, err error)

func (*BPTrainer) Train

func (t *BPTrainer) Train() error

Train tries to perform gradient descent using backpropagation

type LearningConfig

type LearningConfig struct {
	Method            ParamUpdateMethod
	LearningRateStart float64
	LearningRateEnd   float64

	Epochs      int
	BatchSize   int
	WeightDecay float64
	Momentum    float64
}

LearningConfig contains the parameters used in the learning process

type ParamUpdateMethod

type ParamUpdateMethod int

ParamUpdateMethod defines the method used to update parameters in each layer

const (
	//Momentum uses the momentum configuration parameter as a low-pass filter to smooth the gradient descent
	Momentum ParamUpdateMethod = iota
	//AdaDelta updates each parameter independently, without a global learning rate
	AdaDelta
	//Adam is a mix of AdaDelta + Momentum
	Adam
)

Jump to

Keyboard shortcuts

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