types

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package types contains most of the objects that the API reads or writes

Index

Constants

View Source
const (
	BipolarSigmoid = "bipolar-sigmoid"

	MultilayerPerceptron = "mlp"
)

Variables

This section is empty.

Functions

func ActivationFuncs added in v0.4.0

func ActivationFuncs() []string

ActivationFuncs returns the list of supported neuron activation functions

func Nets added in v0.4.0

func Nets() []string

Nets returns the list of supported network types

Types

type BriefNet

type BriefNet struct {
	Accuracy       float32            `json:"accuracy" example:"0.9"` // Fraction of patterns that were predicted correctly during testing
	ActivationFunc string             `json:"activationFunc"`         // Function used to calculate the output of a neuron based on its inputs
	Averages       map[string]float32 `json:"averages"`               // Averages of each value in the patterns that were used for training
	Deviations     map[string]float32 `json:"deviations"`             // Standard deviation of each value in the patterns that were used for training
	ErrMargin      float32            `json:"errMargin"`              // Maximum difference between the expected and produced result to still be considered correct during testing
	HLayers        int                `json:"hLayers"`                // Number of hidden layers
	ID             string             `json:"id"`
	Inputs         []string           `json:"inputs"`
	LearningRate   float32            `json:"learningRate"` // How much new inputs altered the network during training
	Outputs        []string           `json:"outputs"`
	Type           string             `json:"type"`
}

BriefNet is a lightweight and standardized representation for neural network parameters

type BriefSeries

type BriefSeries struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

BriefSeries is a lightweight representation of a time series

type CategorizedPoint

type CategorizedPoint struct {
	Inputs    map[string]float32 `json:"inputs"`
	Outputs   map[string]float32 `json:"outputs"`
	TimeStamp int64              `json:"timestamp"`
}

CategorizedPoint is similar to pointstores.Point but has its values divided into inputs and outputs (this separation isn't important when it comes to storing it but allows producers to state their intentions so that, when enough points are available, a training request can be automatically generated)

func (*CategorizedPoint) HasChanged

func (cp *CategorizedPoint) HasChanged(other CategorizedPoint) bool

HasChanged checks that at least one input and one output is different from the given point. As we're going to be using these to train a neural network it's important that we don't effectively just train it to recognize one value very well or that the inputs have 0 influence on the outputs

type MetricsUpdate

type MetricsUpdate struct {
	SeriesID  string             `json:"seriesID"`
	ErrMargin float32            `json:"errMargin"` // How much the predicted value of the net can differ from the actual but still be considered acceptable
	Labels    map[string]string  `json:"labels"`
	Points    []CategorizedPoint `json:"points"`
	Stage     string             `json:"stage"` // Valid stages are test or production
}

MetricsUpdate bundles snapshots of a set of values that share some relation that could be used to predict each other in a system. This relation doesn't need to be understood (otherwise implement a specific tool for it) but it should be there for everything to work

type PagedRes

type PagedRes struct {
	Last    bool        `json:"last"`
	Next    int         `json:"next"`
	Results interface{} `json:"results"`
}

PagedRes is a wrapper for a paged response where next can be provided as offset for the subsequent request and last can be used to determine when there is nothing left to read

type SimpleRes added in v0.3.0

type SimpleRes struct {
	Result string `json:"result"` // Possible values are "error" and "ok"
	Msg    string `json:"message"`
}

SimpleRes is used for errors and those cases where the response code would be sufficient but a JSON response helps consistency and user friendliness

func NewErrorRes added in v0.3.0

func NewErrorRes(msg string) *SimpleRes

NewErrorRes is a shortcut for building a SimpleRes for a failed result

func NewOkRes added in v0.3.0

func NewOkRes(msg string) *SimpleRes

NewOkRes is a shortcut for building a SimpleRes for a successful result

type TrainRequest

type TrainRequest struct {
	ErrMargin float32  `json:"errMargin"` // Maximum difference between the expected and produced result to still be considered correct during testing
	Inputs    []string `json:"inputs"`    // Which of the series values should be treated as inputs
	Outputs   []string `json:"outputs"`   // Which of the series values should be treated as outputs
	Required  int      `json:"required"`  // Number of points from the series that should be used to train and test
	SeriesID  string   `json:"seriesID"`
}

TrainRequest as its name implies, is used to ask the training service to create or update a net

Jump to

Keyboard shortcuts

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