tuner

package
v1.55.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Beta1 float64 = 0.9
	Beta2 float64 = 0.999
)
View Source
const (
	BatchSize = 16384
)

Variables

View Source
var (
	LearningRate = 0.01
)

Functions

func CalculateCostGradient

func CalculateCostGradient(output, target float64) float64

func Run

func Run(
	ctx context.Context,
	datasetProvider IDatasetProvider,
	validationProvider IDatasetProvider,
	tunableEvaluator ITunableEvaluator,
	threads int,
	epochs int,
	sigmoidScale float64,
) error

func ValidationCost

func ValidationCost(output, target float64) float64

Types

type Gradient

type Gradient struct {
	Value float64
	M1    float64
	M2    float64
}

func (*Gradient) Apply

func (g *Gradient) Apply(elem *float64)

func (*Gradient) Calculate

func (g *Gradient) Calculate() float64

func (*Gradient) Reset

func (g *Gradient) Reset()

func (*Gradient) Update

func (g *Gradient) Update(delta float64)

type IDatasetProvider

type IDatasetProvider interface {
	Load(ctx context.Context, dataset chan<- domain.DatasetItem) error
}

type ITunableEvaluator

type ITunableEvaluator interface {
	EnableTuning()
	StartingWeights() []float64
	ComputeFeatures(pos *common.Position) domain.TuneEntry
}

type Sample

type Sample struct {
	Target float32
	domain.TuneEntry
}

type ThreadData

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

type Trainer

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

func NewTrainer

func NewTrainer(
	training, validation []Sample,
	startingWeights []float64,
	threads int,
	sigmoidScale float64,
) *Trainer

func (*Trainer) Sigmoid

func (t *Trainer) Sigmoid(x float64) float64

func (*Trainer) SigmoidPrime

func (t *Trainer) SigmoidPrime(x float64) float64

func (*Trainer) Train

func (t *Trainer) Train(epochs int) error

Jump to

Keyboard shortcuts

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