weights

package
v1.4.31 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: BSD-3-Clause Imports: 8 Imported by: 10

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 -- 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
	Prjns    []Prjn               // receiving projections
}

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 Prjn

type Prjn struct {
	From     string
	MetaData map[string]string    // used for optional prjn-level params, metadata such as GScale
	MetaVals map[string][]float32 // optional values at the projection level
	Rs       []Recv
}

Prjn is temp structure for holding decoded weights, one for each projection

func PrjnReadJSON

func PrjnReadJSON(r io.Reader) (*Prjn, error)

PrjnReadJSON reads weights for prjn in a JSON format into Prjn structure

func (*Prjn) SetMetaData

func (pj *Prjn) 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