network

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Activation

type Activation interface {
	Value(float64) float64
	MatrixDerivative(outputs mat.Matrix) (*mat.Dense, error)
}

type ActivationType

type ActivationType int
const (
	ActivationTypeNone ActivationType = iota
	ActivationTypeSigmoid
	ActivationTypeTanh
)

type Config

type Config struct {
	InputCount  int
	LayerCounts []int
	Activation  ActivationType
	Rate        float64
	RandSeed    uint64
	RandState   uint64
	Trained     uint64
}

Config network constructor.

type Network

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

Network struct.

func New

func New(cfg Config, weights []*mat.Dense) (*Network, error)

New constructs a new network with the specified layer weights.

func NewRandom

func NewRandom(cfg Config) (*Network, error)

NewRandom constructs a new network with random weights from a config.

func (Network) Config

func (n Network) Config() Config

Config gets the networks configuration.

func (*Network) MarshalJSON

func (n *Network) MarshalJSON() ([]byte, error)

func (Network) Predict

func (n Network) Predict(inputData []float64) (*mat.Dense, error)

Predict outputs from a trained network.

func (*Network) Train

func (n *Network) Train(input []float64, target []float64) error

Train the network with a single set of inputs and target outputs.

func (Network) Trained

func (n Network) Trained() uint64

Trained returns the number of training runs.

func (*Network) UnmarshalJSON

func (n *Network) UnmarshalJSON(data []byte) error

type Rand

type Rand struct {
	Seed  uint64
	State uint64
}

Rand allows pseudo-random number generation that can be restored to a specific state for reproducible generation.

func (Rand) GetSource

func (r Rand) GetSource() rand.Source

GetSource returns a new seeded source at the current state.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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