rnn

package
v0.0.0-...-f670fa3 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RNN

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

RNN represents the neural network This RNNs parameters are the three mat64rices whh, wxh, why. hprev is the last known hidden vector, which is actually the memory of the RNN bh, and by are the biais vectors respectivly for the hidden layer and the output layer

func NewRNN

func NewRNN(inputNeurons, outputNeurons int) *RNN

NewRNN creates a new RNN with input size of x, outputsize of y and hidden dimension of h The hidden state h is initialized with the zero vectornn. func newRNN(x, y, h int) *RNN {

func (*RNN) GobDecode

func (rnn *RNN) GobDecode(b []byte) error

GobDecode the rnn for restoring

func (*RNN) GobEncode

func (rnn *RNN) GobEncode() ([]byte, error)

GobEncode the RNN for backup

func (*RNN) Predict

func (rnn *RNN) Predict(xs [][]float64, n int, adapt func([]float64) []float64) [][]float64

Predict n element of output that corresponds to the input xs At every iteration, the output is processed by the adapt function

func (*RNN) Train

func (rnn *RNN) Train() (chan<- TrainingSet, <-chan float64)

Train the network. The train mechanisme is launched in a seperate go-routine it is waiting for an input to be sent in the feeding channel

type TrainingSet

type TrainingSet struct {
	Inputs  [][]float64
	Targets [][]float64
}

TrainingSet represents an input mat64rix and the expected result when passed through a rnn

func CopyOf

func CopyOf(tset TrainingSet) TrainingSet

CopyOf the trainingset passed as parameter

Jump to

Keyboard shortcuts

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