char

package
Version: v0.0.0-...-1581884 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: Apache-2.0 Imports: 9 Imported by: 1

README

This is an implementation of a datasetter specialized in getting char based training set

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prediction

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

Prediction is the based type that can be used as a training dataset

func NewPrediction

func NewPrediction(input string, runeToIdx func(r rune) (int, error), sampleSize, vocabSize int) *Prediction

NewPrediction return an object suitable for the LSTM

func (*Prediction) GetOutput

func (p *Prediction) GetOutput() [][]float32

GetOutput ...

func (*Prediction) Read

func (p *Prediction) Read() ([]float32, error)

Float32Read ...

func (*Prediction) Write

func (p *Prediction) Write(val []float32) error

Float32Write ...

type Section

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

Section ...

func (*Section) GetComputedVectors

func (s *Section) GetComputedVectors() G.Nodes

GetComputedVectors ..

func (*Section) GetExpectedValue

func (s *Section) GetExpectedValue(offset int) (int, error)

GetExpectedValue returns the encoded value of the rune next to the one present at offset

func (*Section) ReadInputVector

func (s *Section) ReadInputVector(g *G.ExprGraph) (*G.Node, error)

ReadInputVector returns the input vector until it reach the penultimate rune the ultimate rune is not used as input within the current section as an input

func (*Section) WriteComputedVector

func (s *Section) WriteComputedVector(n *G.Node) error

WriteComputedVector add the computed vectors to the output

type TrainingSet

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

TrainingSet ...

func NewTrainingSet

func NewTrainingSet(rs io.ReadSeeker, runeToIdx func(r rune) (int, error), vocabSize, batchsize, step int) *TrainingSet

NewTrainingSet from a ReadSeeker

func (*TrainingSet) GetTrainer

func (t *TrainingSet) GetTrainer() (datasetter.Trainer, error)

GetTrainer returns a pointer so a Section. It reads batchSize runes and add it to the returned section. The offset of the underlying io.ReadSeeker is set to the position it had when entering the function + step * runes * rune_size Any error in reading is returned

Jump to

Keyboard shortcuts

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