nnl1

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/nnl1

details

it implements a simple linear model in the form:

y = x * W + B
where, x is input, W is weights matrix and B is biases matrix

a new trainer can be initialized as follows:

func New(numFeatures, numClasses int, learningRate float64) (*Op, error) {...}
// numFeatures is the number of features per observation
// numClasses is the number of classes prediction is required for.
// and learning rate, (start with 0.0003)

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(numFeatures, numClasses 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