weights

package
v2.0.0-dev0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: BSD-3-Clause Imports: 9 Imported by: 2

README

Docs: GoDoc

Package weights provides weight loading routines that parse weight files into a temporary structure that can then be used to set weight values in the network. This is much simpler and allows use of the standard Go json Unmarshal routines.

Documentation

Overview

Package weights provides weight loading routines that parse weight files into a temporary structure that can then be used to set weight values in the network. This is much simpler and allows use of the standard Go json Unmarshal routines.

Index

Constants

This section is empty.

Variables

View Source
var Prec = 4

Prec is the precision for weight output in text formats. The default is aggressive for Leabra models. May need to increase for other models.

Functions

This section is empty.

Types

type Layer

type Layer struct {
	Layer    string
	MetaData map[string]string    // for optional layer-level params, metadata such as ActMAvg, ActPAvg
	Units    map[string][]float32 // for unit-level adapting parameters
	Paths    []Path               // receiving pathways
}

Layer is temp structure for holding decoded weights, one for each layer

func LayReadJSON

func LayReadJSON(r io.Reader) (*Layer, error)

LayReadJSON reads weights for layer in a JSON format into Layer structure

func (*Layer) SetMetaData

func (ly *Layer) SetMetaData(key, val string)

type Network

type Network struct {
	Network  string
	MetaData map[string]string // used for optional network-level params, metadata
	Layers   []Layer
}

Network is temp structure for holding decoded weights

func NetReadCpp

func NetReadCpp(r io.Reader) (*Network, error)

NetReadCpp reads weights for entire network from old emergent C++ format

func NetReadJSON

func NetReadJSON(r io.Reader) (*Network, error)

NetReadJSON reads weights for entire network in a JSON format into Network structure

func (*Network) SetMetaData

func (nt *Network) SetMetaData(key, val string)

type Path

type Path struct {
	From       string
	MetaData   map[string]string    // used for optional path-level params, metadata such as GScale
	MetaValues map[string][]float32 // optional values at the pathway level
	Rs         []Recv
}

Path is temp structure for holding decoded weights, one for each pathway

func PathReadJSON

func PathReadJSON(r io.Reader) (*Path, error)

PathReadJSON reads weights for path in a JSON format into Path structure

func (*Path) SetMetaData

func (pj *Path) SetMetaData(key, val string)

type Recv

type Recv struct {
	Ri  int
	N   int
	Si  []int
	Wt  []float32
	Wt1 []float32 // call extra synapse-level vars 1,2..
	Wt2 []float32 // call extra synapse-level vars 1,2..
}

Recv is temp structure for holding decoded weights, one for each recv unit

Jump to

Keyboard shortcuts

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