predict

package
v0.0.0-...-018471a Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	TensorTypeFloat = TensorType(iota)
	TensorTypeDouble
	TensorTypeInt32
	TensorTypeUInt32
	TensorTypeInt16
	TensorTypeInt8
	TensorTypeUInt8
	TensorTypeString
	TensorTypeComplex64
	TensorTypeComplex128
	TensorTypeInt64
	TensorTypeUInt64
	TensorTypeBool
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Class

type Class struct {
	Label string
	Score float32
}

Class struct returned by classify calls to a model

type Example

type Example = example.Example

An Example is a mostly-normalized data format for storing data for training and inference. It contains a key-value store (features); where each key (string) maps to a Feature message (which is oneof packed BytesList, FloatList, or Int64List).

type Examplifier

type Examplifier interface {
	Examples() ([]*Example, error)
}

Examplifier interface for types that can be converted to examples

type Feature

type Feature = example.Feature

Feature contains Lists which may hold zero or more values.

type MapExample

type MapExample map[string]interface{}

MapExample map type that implements Examplifier interface

func (MapExample) Examples

func (me MapExample) Examples() ([]*Example, error)

Examples returns examples (one example) from a given map

type ModelInfo

type ModelInfo struct {
	Name    string
	Version int
}

ModelInfo struct contains infomation about the model used for the prediction (name, version, etc.)

type Predictor

type Predictor interface {
	// Predict runs prediction with given input map. Output is filtered with given filter. (nil defaults to all outputs)
	Predict(ctx context.Context, inputs map[string]interface{}, outputFilter []string) (map[string]Tensor, ModelInfo, error)
	// Classify runs classify with given features and context
	Classify(ctx context.Context, examples []*Example, context *Example) ([][]Class, ModelInfo, error)
	// Regress runs regression with given features and context
	Regress(ctx context.Context, examples []*Example, context *Example) ([]Regression, ModelInfo, error)
	// GetModelInfo returns the ModelInfo for the Predictor
	GetModelInfo(ctx context.Context) (ModelInfo, error)
}

Predictor interface for unified model execution with different backend (embedded go model & tensorflow serving)

type Regression

type Regression struct {
	Value float32
}

Regression struct returned by regress calls to a model

type Tensor

type Tensor interface {
	Value() interface{}
	Shape() []int64
	Type() TensorType
}

Tensor unified interface for Tensors

type TensorType

type TensorType int

TensorType type of the tensor

Jump to

Keyboard shortcuts

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