nnl4

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: MIT Imports: 6 Imported by: 0

README

train

this is a simple go wrapper on TensorFlow trainer.

installation

install Go API for TensorFlow https://www.tensorflow.org/install/lang_go

$ go get github.com/sdeoras/comp/nn/nnl4

details

it implements a simple linear model in the form:

y1 = x * W1 + B1  // with relu
y2 = y1 * W2 + B2 // with relu
y3 = y2 * W3 + B3 // with relu
y = y3 * W4 + B4 // with softmax
where, x is input, Wx's are weights matrices and Bx's are biases matrices

a new trainer can be initialized as follows:

func New(dim []int, learningRate float64) (*Op, error) {...}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Op

type Op struct {
	// It embeds common op
	common.Op
	// contains filtered or unexported fields
}

func New

func New(dim []int, learningRate float64, name, logdir string, options *tf.SessionOptions) (*Op, error)

New provides a new trainer operator that can be used to feed taining data and step through training process.

func NewOperator

func NewOperator(options *tf.SessionOptions) (*Op, error)

NewOperator provides an instance of new operator for interfacing with TF.

func (*Op) Load

func (op *Op) Load(checkPoint *nn.CheckPoint) error

Load loads a given checkpoitn into current training session of receiver.

func (*Op) Predict

func (op *Op) Predict(data *nn.Data) (*nn.PredictionOutput, error)

Predict does inference on given data.

func (*Op) Save

func (op *Op) Save() (*nn.CheckPoint, error)

Save saves model checkpoint.

func (*Op) Step

func (op *Op) Step(trainingData, validationData *nn.Data) (*nn.TrainingOutput, error)

Step steps through iteration process.

Jump to

Keyboard shortcuts

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