net

package
v0.0.0-...-e2be882 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const FOREST_KEY string = "net.RandomForest"
View Source
const GRU_KEY string = "net.GRU"
View Source
const HMM_KEY string = "net.HMM"
View Source
const NN_KEY string = "net.NeuralNet"
View Source
const POLY_KEY string = "net.Polynomial"

Variables

This section is empty.

Functions

func BaseNetworkConstructor

func BaseNetworkConstructor(in, out int) func(key model.Key, segments mlmodel.Segments) *BaseNetwork

func SV

func SV(v []float64) xmath.Vector

func V

func V(v []float64) xmath.Vector

Types

type BaseNetwork

type BaseNetwork struct {
	// contains filtered or unexported fields
}

BaseNetwork represents the basic network flow logic

func NewBaseNetwork

func NewBaseNetwork(key model.Key, in, out int, gen ...ConstructNetwork) *BaseNetwork

func (*BaseNetwork) Push

func (b *BaseNetwork) Push(k model.Key, vv mlmodel.Vector) (map[mlmodel.Detail][][]float64, bool, error)

Push receives a vector event and processes it with the provided network as a input-output tensor

type ConstructNetwork

type ConstructNetwork func() (Network, mlmodel.Model)

ConstructNetwork defines a network constructor func.

type DataSet

type DataSet struct {
	Key model.Key

	In      [][]float64
	Out     [][]float64
	PrevOut [][]float64
	// contains filtered or unexported fields
}

DataSet is a single training segment of several input and output tensors

func NewDataSet

func NewDataSet(in, out int) DataSet

func (*DataSet) Push

func (ds *DataSet) Push(k model.Key, vv mlmodel.Vector) ([][]float64, bool, error)

func (*DataSet) String

func (ds *DataSet) String() string

type GRU

type GRU struct {
	// contains filtered or unexported fields
}

func NewGRU

func NewGRU(config mlmodel.Model) *GRU

func (*GRU) Config

func (gru *GRU) Config() mlmodel.Model

func (*GRU) Load

func (gru *GRU) Load(key model.Key, detail mlmodel.Detail) error

func (*GRU) Loss

func (gru *GRU) Loss(actual, predicted [][]float64) []float64

func (*GRU) Predict

func (gru *GRU) Predict(x [][]float64) ([][]float64, ml.Metadata, error)

func (*GRU) Save

func (gru *GRU) Save(key model.Key, detail mlmodel.Detail) error

func (*GRU) Train

func (gru *GRU) Train(x [][]float64, y [][]float64) (ml.Metadata, error)

type HMM

type HMM struct {
	// contains filtered or unexported fields
}

func NewHMM

func NewHMM(cfg mlmodel.Model) *HMM

func (*HMM) Config

func (hmm *HMM) Config() mlmodel.Model

func (*HMM) Load

func (hmm *HMM) Load(key model.Key, detail mlmodel.Detail) error

func (*HMM) Loss

func (hmm *HMM) Loss(actual, predicted [][]float64) []float64

func (*HMM) Predict

func (hmm *HMM) Predict(x [][]float64) ([][]float64, ml.Metadata, error)

func (*HMM) Save

func (hmm *HMM) Save(key model.Key, detail mlmodel.Detail) error

func (*HMM) Train

func (hmm *HMM) Train(x [][]float64, y [][]float64) (ml.Metadata, error)

type MultiNetwork

type MultiNetwork struct {
	// contains filtered or unexported fields
}

func NewMultiNetwork

func NewMultiNetwork(nn ...Network) *MultiNetwork

func (*MultiNetwork) Config

func (m *MultiNetwork) Config() mlmodel.Model

func (*MultiNetwork) Load

func (m *MultiNetwork) Load(key model.Key, detail mlmodel.Detail) error

func (*MultiNetwork) Loss

func (m *MultiNetwork) Loss(actual, predicted [][]float64) []float64

func (*MultiNetwork) Predict

func (m *MultiNetwork) Predict(x [][]float64) ([][]float64, ml.Metadata, error)

func (*MultiNetwork) Save

func (m *MultiNetwork) Save(key model.Key, detail mlmodel.Detail) error

func (*MultiNetwork) Train

func (m *MultiNetwork) Train(x [][]float64, y [][]float64) (ml.Metadata, error)

type Network

type Network interface {
	Train(x [][]float64, y [][]float64) (ml.Metadata, error)
	Predict(x [][]float64) ([][]float64, ml.Metadata, error)
	Loss(actual, predicted [][]float64) []float64
	Config() mlmodel.Model
	Load(key model.Key, detail mlmodel.Detail) error
	Save(key model.Key, detail mlmodel.Detail) error
}

Network is a generic network interface that receives a list of tensors and input an output

func NewNetwork

func NewNetwork(s string, cfg mlmodel.Model) Network

type NeuralNet

type NeuralNet struct {
	// contains filtered or unexported fields
}

func NewNeuralNet

func NewNeuralNet(cfg mlmodel.Model) *NeuralNet

func (*NeuralNet) Config

func (n *NeuralNet) Config() mlmodel.Model

func (*NeuralNet) Load

func (n *NeuralNet) Load(key model.Key, detail mlmodel.Detail) error

func (*NeuralNet) Loss

func (n *NeuralNet) Loss(actual, predicted [][]float64) []float64

func (*NeuralNet) Predict

func (n *NeuralNet) Predict(x [][]float64) ([][]float64, ml.Metadata, error)

func (*NeuralNet) Save

func (n *NeuralNet) Save(key model.Key, detail mlmodel.Detail) error

func (*NeuralNet) Train

func (n *NeuralNet) Train(x [][]float64, y [][]float64) (ml.Metadata, error)

type Performance

type Performance struct {
	Total    int
	Match    int
	False    int
	Detail   mlmodel.Detail
	Accuracy float64
	Loss     float64
}

type Performances

type Performances []Performance

func (Performances) Len

func (u Performances) Len() int

func (Performances) Less

func (u Performances) Less(i, j int) bool

func (Performances) Swap

func (u Performances) Swap(i, j int)

type Polynomial

type Polynomial struct {
	// contains filtered or unexported fields
}

func NewPolynomial

func NewPolynomial(cfg mlmodel.Model) *Polynomial

func (*Polynomial) Config

func (p *Polynomial) Config() mlmodel.Model

func (*Polynomial) Load

func (p *Polynomial) Load(key model.Key, detail mlmodel.Detail) error

func (*Polynomial) Loss

func (p *Polynomial) Loss(actual, predicted [][]float64) []float64

func (*Polynomial) Predict

func (p *Polynomial) Predict(x [][]float64) ([][]float64, ml.Metadata, error)

func (*Polynomial) Save

func (p *Polynomial) Save(key model.Key, detail mlmodel.Detail) error

func (*Polynomial) Train

func (p *Polynomial) Train(x [][]float64, y [][]float64) (ml.Metadata, error)

type RandomForest

type RandomForest struct {
	// contains filtered or unexported fields
}

func NewRandomForest

func NewRandomForest(cfg mlmodel.Model) *RandomForest

func (*RandomForest) Config

func (r *RandomForest) Config() mlmodel.Model

func (*RandomForest) Load

func (r *RandomForest) Load(key model.Key, detail mlmodel.Detail) error

func (*RandomForest) Loss

func (r *RandomForest) Loss(actual, predicted [][]float64) []float64

func (*RandomForest) Predict

func (r *RandomForest) Predict(x [][]float64) ([][]float64, ml.Metadata, error)

func (*RandomForest) Save

func (r *RandomForest) Save(key model.Key, detail mlmodel.Detail) error

func (*RandomForest) Train

func (r *RandomForest) Train(x [][]float64, y [][]float64) (ml.Metadata, error)

type Stats

type Stats struct {
	Accuracy   *buffer.Buffer
	Loss       *buffer.Buffer
	Prediction [][]float64
	Decisions  []int
}

Stats defines generic network Stats.

func NewStats

func NewStats(s int) Stats

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker defines a base network implementation

func NewTracker

func NewTracker(size int) *Tracker

NewTracker creates a new single network

func (*Tracker) SetLast

func (bn *Tracker) SetLast(last [][]float64)

Jump to

Keyboard shortcuts

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