perceptron

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PercepAllOut bool = false

Functions

func DefaultStopCondition

func DefaultStopCondition(iteration, iterations, generations int, model Model) bool

Types

type AveragedStrategy

type AveragedStrategy struct {
	P, N int64
	// contains filtered or unexported fields
}

func (*AveragedStrategy) Finalize

func (u *AveragedStrategy) Finalize(m Model) Model

func (*AveragedStrategy) Init

func (u *AveragedStrategy) Init(m Model, iterations int)

func (*AveragedStrategy) Update

func (u *AveragedStrategy) Update(m Model)

type Decoded

type Decoded struct {
	InstanceVal Instance
	DecodedVal  util.Equaler
}

func (*Decoded) Decoded

func (d *Decoded) Decoded() interface{}

func (*Decoded) Equal

func (d *Decoded) Equal(otherEq util.Equaler) bool

func (*Decoded) Instance

func (d *Decoded) Instance() Instance

type DecodedInstance

type DecodedInstance interface {
	Instance
	Instance() Instance
	Decoded() interface{}
}

type EarlyUpdateInstanceDecoder

type EarlyUpdateInstanceDecoder interface {
	DecodeEarlyUpdate(i DecodedInstance, m Model) (decoded DecodedInstance, decodedFeatures, goldFeatures interface{}, earlyUpdatedAt, goldSize int, decodeScore float64)
}

type EmptyFeatureExtractor

type EmptyFeatureExtractor struct {
}

func (*EmptyFeatureExtractor) EstimatedNumberOfFeatures

func (e *EmptyFeatureExtractor) EstimatedNumberOfFeatures() int

func (*EmptyFeatureExtractor) Features

func (e *EmptyFeatureExtractor) Features(i Instance, flag bool, ttype byte, arr []int) []Feature

func (*EmptyFeatureExtractor) SetLog

func (e *EmptyFeatureExtractor) SetLog(flag bool)

type FeatureExtractor

type FeatureExtractor interface {
	Features(instance Instance, flag bool, transType byte, trans_values []int) []Feature
	EstimatedNumberOfFeatures() int
	SetLog(bool)
}

type Instance

type Instance interface {
	util.Equaler
}

type InstanceDecoder

type InstanceDecoder interface {
	Decode(i Instance, m Model) (DecodedInstance, interface{})
	DecodeGold(i DecodedInstance, m Model) (DecodedInstance, interface{})
}

type LinearPerceptron

type LinearPerceptron struct {
	Decoder        EarlyUpdateInstanceDecoder
	GoldDecoder    InstanceDecoder
	Updater        UpdateStrategy
	Iterations     int
	Model          Model
	Log            bool
	Tempfile       string
	TrainI, TrainJ int
	TempLines      int

	FailedInstances int

	Continue StopCondition
}

func (*LinearPerceptron) Init

func (m *LinearPerceptron) Init(newModel Model)

func (*LinearPerceptron) Train

func (m *LinearPerceptron) Train(goldInstances []DecodedInstance)

type Model

type Model interface {
	// util.Persist
	Score(features interface{}) int64
	Add(features interface{}) Model
	Subtract(features interface{}) Model
	AddSubtract(goldFeatures, decodedFeatures interface{}, amount int64)
	ScalarDivide(int64)
	Copy() Model
	AddModel(Model)
	New() Model
}

type StopCondition

type StopCondition func(curIt, numIt, generations int, model Model) bool

type SupervisedTrainer

type SupervisedTrainer interface {
	Train(instances []DecodedInstance)
}

type TrivialStrategy

type TrivialStrategy struct{}

func (*TrivialStrategy) Finalize

func (u *TrivialStrategy) Finalize(m Model) Model

func (*TrivialStrategy) Init

func (u *TrivialStrategy) Init(m Model, iterations int)

func (*TrivialStrategy) Update

func (u *TrivialStrategy) Update(m Model)

type UnsupervisedTrainer

type UnsupervisedTrainer interface {
	Train(instances []Instance)
}

unused, here for completeness

type UpdateStrategy

type UpdateStrategy interface {
	Init(m Model, iterations int)
	Update(model Model)
	Finalize(m Model) Model
}

Jump to

Keyboard shortcuts

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