Documentation
¶
Index ¶
- Variables
- func ClusterPlot(plt *plotcore.PlotEditor, ix *table.IndexView, colNm, lblNm string, ...)
- func ConfigPCAPlot(plt *plotcore.PlotEditor, dt *table.Table, nm string)
- func DiName(name string, di int) string
- type Stats
- func (st *Stats) ActRFsAvgNorm()
- func (st *Stats) ClosestPat(net emer.Network, layNm, unitVar string, di int, pats *table.Table, ...) (int, float32, string)
- func (st *Stats) ConfigRasters(net emer.Network, maxCyc int, layers []string)
- func (st *Stats) F32Tensor(name string) *tensor.Float32
- func (st *Stats) F32TensorDi(name string, di int) *tensor.Float32
- func (st *Stats) F64Tensor(name string) *tensor.Float64
- func (st *Stats) F64TensorDi(name string, di int) *tensor.Float64
- func (st *Stats) Float(name string) float64
- func (st *Stats) Float32(name string) float32
- func (st *Stats) Float32Di(name string, di int) float32
- func (st *Stats) FloatDi(name string, di int) float64
- func (st *Stats) Init()
- func (st *Stats) InitActRFs(net emer.Network, arfs []string, varnm string) error
- func (st *Stats) Int(name string) int
- func (st *Stats) IntDi(name string, di int) int
- func (st *Stats) IntTensor(name string) *tensor.Int
- func (st *Stats) IntTensorDi(name string, di int) *tensor.Int
- func (st *Stats) LayerVarsCorrel(net emer.Network, layNm, unitVarA, unitVarB string, di int) float32
- func (st *Stats) LayerVarsCorrelRep(net emer.Network, layNm, unitVarA, unitVarB string, di int) float32
- func (st *Stats) LinearDecodeTrain(decName, varNm string, di int, trainVal float32) (float32, error)
- func (st *Stats) PCAStats(ix *table.IndexView, varNm string, layers []string)
- func (st *Stats) Plot(name string) *plotcore.PlotEditor
- func (st *Stats) Print(stats []string) string
- func (st *Stats) PrintValues(stats, fmts []string, delim string) string
- func (st *Stats) RasterRec(net emer.Network, cyc int, varNm string, di int)
- func (st *Stats) ResetStartTimer(name string) *timer.Time
- func (st *Stats) ResetTimer(name string) *timer.Time
- func (st *Stats) SetF32Tensor(name string, tsr *tensor.Float32)
- func (st *Stats) SetF32TensorDi(name string, di int, tsr *tensor.Float32)
- func (st *Stats) SetF64Tensor(name string, tsr *tensor.Float64)
- func (st *Stats) SetF64TensorDi(name string, di int, tsr *tensor.Float64)
- func (st *Stats) SetFloat(name string, value float64)
- func (st *Stats) SetFloat32(name string, value float32)
- func (st *Stats) SetFloat32Di(name string, di int, value float32)
- func (st *Stats) SetFloatDi(name string, di int, value float64)
- func (st *Stats) SetInt(name string, value int)
- func (st *Stats) SetIntDi(name string, di int, value int)
- func (st *Stats) SetIntTensor(name string, tsr *tensor.Int)
- func (st *Stats) SetIntTensorDi(name string, di int, tsr *tensor.Int)
- func (st *Stats) SetLayerSampleTensor(net emer.Network, layNm, unitVar string, di int) *tensor.Float32
- func (st *Stats) SetLayerTensor(net emer.Network, layNm, unitVar string, di int) *tensor.Float32
- func (st *Stats) SetRasterCol(sr, tsr *tensor.Float32, col int)
- func (st *Stats) SetString(name string, value string)
- func (st *Stats) SetStringDi(name string, di int, value string)
- func (st *Stats) SimMat(name string) *simat.SimMat
- func (st *Stats) SoftMaxDecodeTrain(decName, varNm string, di int, trainIndex int) (float32, error)
- func (st *Stats) StartTimer(name string) *timer.Time
- func (st *Stats) StopTimer(name string) *timer.Time
- func (st *Stats) String(name string) string
- func (st *Stats) StringDi(name string, di int) string
- func (st *Stats) Timer(name string) *timer.Time
- func (st *Stats) UpdateActRFs(net emer.Network, varnm string, thr float32, di int)
Constants ¶
This section is empty.
Variables ¶
var PCAStrongThr = 0.01
PCAStrongThr is the threshold for counting PCA eigenvalues as "strong" Applies to SVD as well.
Functions ¶
func ClusterPlot ¶
func ClusterPlot(plt *plotcore.PlotEditor, ix *table.IndexView, colNm, lblNm string, dfunc clust.DistFunc)
ClusterPlot does one cluster plot on given table column name and label name
func ConfigPCAPlot ¶
func ConfigPCAPlot(plt *plotcore.PlotEditor, dt *table.Table, nm string)
Types ¶
type Stats ¶
type Stats struct { Floats map[string]float64 Strings map[string]string Ints map[string]int // float32 tensors used for grabbing values from layers F32Tensors map[string]*tensor.Float32 // float64 tensors as needed for other computations F64Tensors map[string]*tensor.Float64 // int tensors as needed for other computations IntTensors map[string]*tensor.Int // confusion matrix Confusion confusion.Matrix `display:"no-inline"` // similarity matrix for comparing pattern similarities SimMats map[string]*simat.SimMat // analysis plots -- created by analysis routines Plots map[string]*plotcore.PlotEditor // one PCA object can be reused for all PCA computations PCA pca.PCA // one SVD object can be reused for all SVD computations SVD pca.SVD // activation-based receptive fields ActRFs actrf.RFs `display:"no-inline"` // list of layer names configured for recording raster plots Rasters []string // linear decoders LinDecoders map[string]*decoder.Linear // softmax decoders SoftMaxDecoders map[string]*decoder.SoftMax // named timers available for timing how long different computations take (wall-clock time) Timers map[string]*timer.Time }
Stats provides maps for storing statistics as named scalar and tensor values. These stats are available in the elog.Context for use during logging.
func (*Stats) ActRFsAvgNorm ¶
func (st *Stats) ActRFsAvgNorm()
ActRFsAvgNorm calls Avg() then Norm() on ActRFs -- this is the standard way to visualize the RFs
func (*Stats) ClosestPat ¶
func (st *Stats) ClosestPat(net emer.Network, layNm, unitVar string, di int, pats *table.Table, colnm, namecol string) (int, float32, string)
ClosestStat finds the closest pattern in given column of given table of possible patterns, compared to layer activation pattern using given variable. Returns the row number, correlation value, and value of a column named namecol for that row if non-empty. Column must be tensor.Float32 di is a data parallel index di, for networks capable of processing input patterns in parallel.
func (*Stats) ConfigRasters ¶
ConfigRasters configures spike rasters for given maximum number of cycles and layer names.
func (*Stats) F32Tensor ¶
F32Tensor returns a float32 tensor of given name, creating if not yet made
func (*Stats) F32TensorDi ¶
F32TensorDi returns a float32 tensor of given name, creating if not yet made Data parallel index version appends _di to name
func (*Stats) F64Tensor ¶
F64Tensor returns a float64 tensor of given name, creating if not yet made
func (*Stats) F64TensorDi ¶
F64TensorDi returns a float64 tensor of given name, creating if not yet made Data parallel index version appends _di to name
func (*Stats) Float ¶
Float returns Floats stat value -- prints error message and returns 0 if not found
func (*Stats) Float32 ¶
Float32 returns Floats stat value converted to float32. prints error message and returns 0 if not found
func (*Stats) Float32Di ¶
Float32Di returns Floats stat value converted to float32. Data parallel index version appends _di to name, doesn't print err because often not present at the start
func (*Stats) FloatDi ¶
FloatDi returns Floats stat value -- returns 0 if not found Data parallel index version appends _di to name, doesn't print err because often not present at the start
func (*Stats) InitActRFs ¶
InitActRFs initializes a set of activation-based receptive field (ActRF) statistics, which record activation-weighted averaging of other tensor states, which can be activations in other layers, or external sensory inputs, or any kind of analytic pattern that helps to decode what the network is doing. The input is a list of colon-separated "Layer:Source" strings, where 'Layer' refers to a name of a layer in the given network, and 'Source' is either the name of another layer (checked first) or the name of a tensor stored in F32Tensors (if layer name not found). If Source is not a layer, it must be populated prior to these calls.
func (*Stats) IntDi ¶
IntDi returns Ints stat value -- 0 if not found Data parallel index version appends _di to name, doesn't print err because often not present at the start
func (*Stats) IntTensorDi ¶
IntTensorDi returns a int tensor of given name, creating if not yet made Data parallel index version appends _di to name
func (*Stats) LayerVarsCorrel ¶
func (st *Stats) LayerVarsCorrel(net emer.Network, layNm, unitVarA, unitVarB string, di int) float32
LayerVarsCorrel returns the correlation between two variables on a given layer di is a data parallel index di, for networks capable of processing input patterns in parallel.
func (*Stats) LayerVarsCorrelRep ¶
func (st *Stats) LayerVarsCorrelRep(net emer.Network, layNm, unitVarA, unitVarB string, di int) float32
LayerVarsCorrelRep returns the correlation between two variables on a given layer Rep version uses representative units. di is a data parallel index di, for networks capable of processing input patterns in parallel.
func (*Stats) LinearDecodeTrain ¶
func (st *Stats) LinearDecodeTrain(decName, varNm string, di int, trainVal float32) (float32, error)
LinearDecodeTrain does decoding and training on the decoder of the given name, using given training value, saving the results to Float stats named with the decoder + Out and SSE. returns SSE. di is a data parallel index di, for networks capable of processing input patterns in parallel.
func (*Stats) PCAStats ¶
PCAStats computes PCA statistics on recorded hidden activation patterns on given log table (IndexView), and given list of layer names and variable name -- columns named "layer_var". Helpful for measuring the overall information (variance) in the representations to detect a common failure mode where a few patterns dominate over everything ("hogs"). Records Float stats as: layer_PCA_NStrong: number of eigenvalues above the PCAStrongThr threshold layer_PCA_Top5: average strength of top 5 eigenvalues layer_PCA_Next5: average strength of next 5 eigenvalues layer_PCA_Rest: average strength of remaining eigenvalues (if more than 10 total eigens) Uses SVD to compute much more efficiently than official PCA.
func (*Stats) Plot ¶
func (st *Stats) Plot(name string) *plotcore.PlotEditor
Plot returns an plotcore.PlotEditor of given name, creating if not yet made
func (*Stats) Print ¶
Print returns a formatted Name: Value string of stat values, suitable for displaying at the bottom of the NetView or otherwise printing. Looks for names of stats in order of fields in Stats object (Floats, Strings, Ints)
func (*Stats) PrintValues ¶
PrintValues returns values of given stats with given formats, and delimiter
func (*Stats) RasterRec ¶
RasterRec records data from layers configured with ConfigRasters using variable name, for given cycle number (X axis index) di is a data parallel index di, for networks capable of processing input patterns in parallel.
func (*Stats) ResetStartTimer ¶
ResetStartTimer resets then starts given named timer
func (*Stats) ResetTimer ¶
ResetTimer resets given named timer
func (*Stats) SetF32Tensor ¶
SetF32Tensor sets a float32 tensor of given name. Just does: st.F32Tensors[name] = tsr
func (*Stats) SetF32TensorDi ¶
SetF32TensorDi sets a float32 tensor of given name. Just does: st.F32Tensors[DiName(name, di)] = tsr Data parallel index version appends _di to name
func (*Stats) SetF64Tensor ¶
SetF64Tensor sets a float64 tensor of given name. Just does: st.F64Tensors[name] = tsr
func (*Stats) SetF64TensorDi ¶
SetF64TensorDi sets a float64 tensor of given name. Just does: st.F64Tensors[DiName(name, di)] = tsr Data parallel index version appends _di to name
func (*Stats) SetFloat32 ¶
SetFloat32 sets Floats stat value using a float32 value
func (*Stats) SetFloat32Di ¶
SetFloat32Di sets Floats stat value using a float32 value Data parallel index version appends _di to name
func (*Stats) SetFloatDi ¶
SetFloatDi sets Floats stat value Data parallel index version appends _di to name
func (*Stats) SetIntDi ¶
SetIntDi sets Ints stat value Data parallel index version appends _di to name
func (*Stats) SetIntTensor ¶
SetIntTensor sets a int tensor of given name. Just does: st.IntTensors[name] = tsr
func (*Stats) SetIntTensorDi ¶
SetIntTensorDi sets a int tensor of given name. Just does: st.IntTensors[DiName(name, di)] = tsr Data parallel index version appends _di to name
func (*Stats) SetLayerSampleTensor ¶
func (st *Stats) SetLayerSampleTensor(net emer.Network, layNm, unitVar string, di int) *tensor.Float32
SetLayerSampleTensor sets tensor of representative Unit values on a layer for given variable to a F32Tensor with name = layNm di is a data parallel index di, for networks capable of processing input patterns in parallel.
func (*Stats) SetLayerTensor ¶
SetLayerTensor sets tensor of Unit values on a layer for given variable to a F32Tensor with name = layNm di is a data parallel index di, for networks capable of processing input patterns in parallel.
func (*Stats) SetRasterCol ¶
SetRasterCol sets column of given raster from data
func (*Stats) SetStringDi ¶
SetStringDi sets Strings stat value Data parallel index version appends _di to name
func (*Stats) SimMat ¶
SimMat returns a SimMat similarity matrix of given name, creating if not yet made
func (*Stats) SoftMaxDecodeTrain ¶
SoftLinearDecodeTrain does decoding and training on the decoder of the given name, using given training index value, saving the results to Float stats named with the decoder + Out and Err. Returns Err which is 1 if output != trainIndex, 0 otherwise. di is a data parallel index di, for networks capable of processing input patterns in parallel.
func (*Stats) StartTimer ¶
StartTimer starts given named timer
func (*Stats) String ¶
String returns Strings stat value -- prints error message and returns "" if not found
func (*Stats) StringDi ¶
StringDi returns Strings stat value -- returns "" if not found Data parallel index version appends _di to name, doesn't print err because often not present at the start
func (*Stats) UpdateActRFs ¶
UpdateActRFs updates activation-based receptive fields with a new sample of data from current network state, and updated state values which must be already updated in F32Tensors. Must have called InitActRFs first -- see it for documentation. Uses RFs configured then, grabbing network values from variable varnm, and given threshold (0.01 recommended) di is a data parallel index di, for networks capable of processing input patterns in parallel.