mlp

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

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

Go to latest
Published: Dec 10, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpImage

func DumpImage(imgs Images, index int, fname string) error

func ErrorRate

func ErrorRate(predictions, labels []float64) float64

func GenXor

func GenXor(n int, stdDev float64) (data_points [][]float64, labels []float64)

func ReLu

func ReLu(x float64) float64

func Sigmoid

func Sigmoid(x float64) float64

func UnitStep

func UnitStep(x float64) float64

Types

type Images

type Images struct {
	MagicNum       uint32
	DataType       string
	Dimensionality uint
	N              uint32
	ImgRows        uint32
	ImgCols        uint32
	Images         [][][]float64
}

func ReadImgs

func ReadImgs(fpath string) (Images, error)

type Labels

type Labels struct {
	MagicNum       uint32
	DataType       string
	Dimensionality uint
	N              uint32
	Labels         []byte
}

func ReadLabels

func ReadLabels(fpath string) (Labels, error)

type Mlp

type Mlp struct {
	InDim     int
	HiddenDim []int
	NHidden   int
	OutDim    int
	ActFunc   func(float64) float64
	Weights   []mat.Matrix
}

func NewMlp

func NewMlp(dims []int, actF func(float64) float64, variance float64) (*Mlp, error)

func (*Mlp) Adapt

func (mlp *Mlp) Adapt(input, target []float64, learning_rate float64)

func (*Mlp) ComputeActivation

func (mlp *Mlp) ComputeActivation(input []float64) (output []float64, activations []*mat.Dense, net_activations []*mat.Dense)

func (*Mlp) GenTestData

func (mlp *Mlp) GenTestData()

func (*Mlp) SetWeights

func (mlp *Mlp) SetWeights(init_ws [][]float64)

func (*Mlp) String

func (mlp *Mlp) String() string

Jump to

Keyboard shortcuts

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