lukai

package module
v0.0.0-...-d9bce91 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: MIT Imports: 31 Imported by: 0

README

Luk.ai Client GoDoc Build Status

This contains all the client libraries for Luk.ai.

The client libraries are designed to be embedded into apps that need to generate predictions, log training data, and train machine learning models.

The management library is for integration with Tensorflow to easily upload models to Luk.ai to be trained.

MNIST example

See Also: Luk.ai Documentation

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MaxFileSize is the target size an example file will be.
	MaxFileSize = 1 * units.MB
	// MaxFileRetention is the duration worth of examples kept.
	MaxFileRetention = 14 * units.Day
	// MaxDiskUsage is the number of bytes that will used for examples.
	MaxDiskUsage = 50 * units.MB
	// MaxFileDuration is the duration worth of examples that will be stored in
	// one file.
	MaxFileDuration = 1 * units.Day
	// IndexFileName is the name of the examples index file.
	IndexFileName = "index.pb"
	// FilePerm is the file permission all the example files use.
	FilePerm os.FileMode = tf.FilePerm
	DirPerm  os.FileMode = 0700

	// GCEvery controls how often the examples garbage collector runs.
	GCEvery = 1 * time.Hour
)
View Source
var (
	ErrNotImplemented = errors.New("not implemented")
	EdgeAddress       = "dns://edge.luk.ai"

	// ModelCacheSize controls how many training models are cached between
	// training iterations.
	ModelCacheSize = 3

	DialTimeout = 60 * time.Second

	// ErrorRateLimit controls how often the client should report errors to the
	// server.
	ErrorRateLimit = 1 * time.Minute
	// MaxQueuedErrors controls how many errors can be queued before they start
	// getting discarded.
	MaxQueuedErrors = 10
)
View Source
var (
	MaxMsgSize = 100 * units.MB

	// TLSConfig is the tls.Config to use for dialing GRPC endpoints. Mostly used
	// for testing purposes.
	TLSConfig *tls.Config
)
View Source
var MaxConcurrentTrainingJobs = 1

MaxConcurrentTrainingJobs is the maximum number of concurrent training jobs that can be running.

Functions

func SetMaxConcurrentTrainingJobs

func SetMaxConcurrentTrainingJobs(n int)

SetMaxConcurrentTrainingJobs sets the maximum number of concurrent training jobs that can be running.

Types

type ModelType

type ModelType struct {
	Domain, ModelType, DataDir string
	// contains filtered or unexported fields
}

func MakeModelType

func MakeModelType(domain, modelType, dataDir string) (*ModelType, error)

MakeModelType creates a new model type with a specified domain and model type and stores all training data in dataDir.

func (*ModelType) Close

func (mt *ModelType) Close() error

func (*ModelType) ExamplesError

func (mt *ModelType) ExamplesError() error

ExamplesError returns the last examples saving error that occured and clears it. I.e. calling ExamplesError twice if there is only one error will return the error the first time and then nil afterwards. If there is no last error it returns nil.

func (*ModelType) GCExamples

func (mt *ModelType) GCExamples() error

GCExamples scans through the example files and deletes any that violate the retention or max file size policies.

func (*ModelType) ID

func (mt *ModelType) ID() aggregatorpb.ModelID

ID returns the current model ID. If there a production model loaded it returns the production model ID, otherwise, the ID field will be blank and just have the domain and model type.

func (*ModelType) IsTraining

func (mt *ModelType) IsTraining() bool

IsTraining returns whether or not a job is training.

func (*ModelType) Log

func (mt *ModelType) Log(feeds map[string]*tensorflow.Tensor, targets []string) error

Log records model input->output pairs for later use in training. This data is saved locally only. - feeds key is the tensorflow output and should be in the form "name:output#". - targets is the name of the tensorflow target and should be in the form "name".

func (*ModelType) Run

func (mt *ModelType) Run(
	ctx context.Context, feeds map[string]*tensorflow.Tensor, fetches []string, targets []string,
) ([]*tensorflow.Tensor, error)

Run runs the model with the provided tensorflow feeds, fetches and targets. The key for feeds, and fetches should be in the form "name:#", and the targets in the form "name".

func (*ModelType) StartTraining

func (mt *ModelType) StartTraining(ctx context.Context) error

StartTraining starts the training worker.

func (*ModelType) StopTraining

func (mt *ModelType) StopTraining() error

StopTraining will asyncronously cause training to stop.

func (*ModelType) TotalExamples

func (mt *ModelType) TotalExamples() int64

TotalExamples returns the number of examples that are currently saved locally.

func (*ModelType) TotalSize

func (mt *ModelType) TotalSize() int64

TotalSize returns the file size of examples that are currently saved locally.

func (*ModelType) TrainingError

func (mt *ModelType) TrainingError() error

TrainingError returns the last training error that occured and clears it. I.e. calling TrainingError twice if there is only one error will return the error the first time and then nil afterwards. If there is no last error it returns nil.

Directories

Path Synopsis
bindable is a wrapper around lukai that is gomobile/gobind compatible.
bindable is a wrapper around lukai that is gomobile/gobind compatible.
github.com
tensorflow/tensorflow/tensorflow/go/core/framework
Package framework is a generated protocol buffer package.
Package framework is a generated protocol buffer package.
tensorflow/tensorflow/tensorflow/go/core/protobuf
Package protobuf is a generated protocol buffer package.
Package protobuf is a generated protocol buffer package.
protobuf
aggregatorpb
Package aggregatorpb is a generated protocol buffer package.
Package aggregatorpb is a generated protocol buffer package.
clientpb
Package clientpb is a generated protocol buffer package.
Package clientpb is a generated protocol buffer package.
managerpb
Package managerpb is a generated protocol buffer package.
Package managerpb is a generated protocol buffer package.
tensorflow
Package tensorflow is a generated protocol buffer package.
Package tensorflow is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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