Documentation ¶
Overview ¶
Package actrf provides activation-based receptive field computation, otherwise known as reverse correlation. It simply computes the activation weighted average of other *source* patterns of activation -- i.e., sum(act * src) / sum(src) which then shows you the patterns of source activity for which a given unit was active.
The RF's are computed and stored in 4D tensors, where the outer 2D are the 2D projection of the activation tensor (e.g., the activations of units in a layer), and the inner 2D are the 2D projection of the source tensor.
This results in a nice standard RF plot that can be visualized in a tensor grid view.
There is a standard ActRF which is cumulative over a user-defined interval and a RunningAvg version which is computed online and continuously updated but is more susceptible to sampling bias (i.e., more sampled areas are more active in general), and a recency bias.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunningAvg ¶
RunningAvg computes a running-average activation-based receptive field for activities act relative to source activations src (the thing we're projecting rf onto) accumulating into output out, with time constant tau. act and src are projected into a 2D space (etensor.Prjn2D* methods), and resulting out is 4D of act outer and src inner.
Types ¶
type RF ¶
type RF struct { Name string `desc:"name of this RF -- used for management of multiple in RFs"` RF etensor.Float32 `view:"no-inline" desc:"computed receptive field, as SumProd / SumSrc -- only after Avg has been called"` NormRF etensor.Float32 `view:"no-inline" desc:"unit normalized version of RF per source (inner 2D dimensions) -- good for display"` SumProd etensor.Float32 `view:"no-inline" desc:"sum of the products of act * src"` SumSrc etensor.Float32 `view:"no-inline" desc:"sum of the sources (denomenator)"` }
RF is used for computing an activation-based receptive field. It simply computes the activation weighted average of other *source* patterns of activation -- i.e., sum(act * src) / sum(src) which then shows you the patterns of source activity for which a given unit was active. You must call Init to initialize everything, Reset to restart the accumulation of the data, and Avg to compute the resulting averages based an accumulated data. Avg does not erase the accumulated data so it can continue beyond that point.
func (*RF) Add ¶
Add adds one sample based on activation and source tensor values. these must be of the same shape as used when Init was called. thr is a threshold value on sources below which values are not added (prevents numerical issues with very small numbers)
type RFs ¶
type RFs struct { NameMap map[string]int `desc:"map of names to indexes of RFs"` RFs []*RF `desc:"the RFs"` }
RFs manages multiple named RF's -- each one must be initialized first but functions like Avg, Norm, and Reset can be called generically on all.
func (*RFs) RFByNameTry ¶
RFByNameTry returns RF of given name, nil and error msg if not found