PetaVision / OpenPV

PetaVision is a C++ library for designing and deploying large-scale neurally-inspired computational models.
http://petavision.github.io
Eclipse Public License 1.0
40 stars 13 forks source link

Local firm-threshold cost #270

Closed peteschultz closed 5 years ago

peteschultz commented 5 years ago

This pull request creates a new layer type, FirmThresholdCostLayer, which uses the GSyn input to calculate a point-by-point evaluation of the firm threshold cost, based on the layer's VThresh and VWidth parameters. The activity of a neuron from a given input x is a = |x| - |x|^2/(2(VThresh + VWidth)) if |x| < VThresh + VWidth a = (VThresh + VWidth)/2 otherwise.

The sum over the entire FirmThresholdCostLayer is then the firm-threshold cost function of the GSyn input, treated as a layer.

This pull request also adds DependentFirmThresholdCostLayer, derived from FirmThresholdCostLayer. Instead of reading VThresh and VWidth, it reads originalLayerName as the name of a layer that contains an ANNActivityBuffer using VThresh/AMax/AMin/AShift/VWidth. It then grabs VThresh and VWidth from the ANNActivityBuffer. The original layer must have AMax = infinity [more technically, AMax >= 0.99*FLT_MAX], AMin = 0, and VShift = 0 (the values necessary for a firm threshold transfer function).