crf

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Viterbi

func Viterbi(transitionMatrix mat.Matrix, xs []ag.Node) []int

Types

type Model

type Model struct {
	TransitionScores *nn.Param `type:"weights"`
}

Model contains the serializable parameters.

func New

func New(labels int) *Model

func (*Model) NewProc

func (m *Model) NewProc(ctx nn.Context) nn.Processor

NewProc returns a new processor to execute the forward step.

func (*Model) Predict

func (m *Model) Predict(emissionScores []ag.Node) []int

type Processor

type Processor struct {
	nn.BaseProcessor
	// contains filtered or unexported fields
}

func (*Processor) Forward

func (p *Processor) Forward(_ ...ag.Node) []ag.Node

Forward is not available for the CRF. Use Predict() instead.

func (*Processor) NegativeLogLoss

func (p *Processor) NegativeLogLoss(emissionScores []ag.Node, target []int) ag.Node

type ViterbiStructure

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

func NewViterbiStructure

func NewViterbiStructure(size int) *ViterbiStructure

NewViterbiStructure returns a new ViterbiStructure ready to use.

func ViterbiStep

func ViterbiStep(transitionMatrix mat.Matrix, maxVec mat.Matrix, stepVec mat.Matrix) *ViterbiStructure

func ViterbiStepEnd

func ViterbiStepEnd(transitionMatrix mat.Matrix, maxVec mat.Matrix) *ViterbiStructure

func ViterbiStepStart

func ViterbiStepStart(transitionMatrix mat.Matrix, maxVec mat.Matrix) *ViterbiStructure

Jump to

Keyboard shortcuts

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