Skip to content

Commit

Permalink
renormalize CaP vs. CaD factors automatically, update docs, keep CaPS…
Browse files Browse the repository at this point in the history
…cale at 0.95 so results will be a bit diff -- renorm factor was 0.98 for CaBins=25, 0.96 for 10
  • Loading branch information
rcoreilly committed Jan 13, 2025
1 parent 5c0ad6f commit b095ae1
Show file tree
Hide file tree
Showing 37 changed files with 65 additions and 61 deletions.
4 changes: 2 additions & 2 deletions axon/learn-path.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions axon/learn-path.goal
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ func (pt *PathParams) SynCa(ctx *Context, si, ri, di uint32, syCaP, syCaD *float
cp += sp * GlobalScalars[GvCaBinWts + GlobalScalarVars(i), 0]
cd += sp * GlobalScalars[cadSt + GlobalScalarVars(i), 0]
}
*syCaP = pt.Learn.DWt.CaPScale * pt.Learn.DWt.CaScale * cp
*syCaD = pt.Learn.DWt.CaScale * cd
*syCaP = pt.Learn.DWt.CaPScale * cp
*syCaD = cd
}

// DWtSynCortex computes the weight change (learning) at given synapse, using the
Expand Down
16 changes: 7 additions & 9 deletions axon/learn.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 7 additions & 9 deletions axon/learn.goal
Original file line number Diff line number Diff line change
Expand Up @@ -749,14 +749,13 @@ type DWtParams struct {
// there is temporal structure to be learned across these longer timescales.
Tau float32 `default:"1,2,4"`

// CaScale is a multiplier on the total synaptic calcium values, computed from products
// of the neuron-level [CaBins] values. If [Context.CaBinCycles] is lower than
// default of 25, then this value needs to be set higher, e.g., 2 for cycles = 10.
CaScale float32 `default:"1"`

// CaPScale is a separate multiplier for the CaP component of synaptic calcium, to
// allow separate weighting of potentiation (CaP) vs. depression (CaD) factors.
CaPScale float32 `default:"1"`
// An increased CaP level results in an overall potentiation bias, which acts
// like a hebbian learning factor. This can be bad for long-term synaptic stability
// and lead to the hog-unit problem, and the default of 0.95 is set to mitigate
// this hogging dynamic.
CaPScale float32 `default:"0.95,1"`

// SubMean is the amount of the mean [dWt] to subtract for updating the online
// learning [LWt] values, producing a zero-sum effect. 1.0 = full zero-sum dWt.
Expand All @@ -776,14 +775,13 @@ type DWtParams struct {
// Dt rate = 1 / tau
Dt float32 `display:"-" json:"-" xml:"-" edit:"-"`

pad float32
pad, pad1 float32
}

func (tp *DWtParams) Defaults() {
tp.Trace.SetBool(true)
tp.Tau = 1
tp.CaScale = 1
tp.CaPScale = 1
tp.CaPScale = 0.95
tp.SubMean = 0
tp.LearnThr = 0
tp.Update()
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/ApplyExtsNeuron.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -822,12 +822,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/Beta1Neuron.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/Beta2Neuron.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/BetweenGi.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -787,12 +787,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/CycleInc.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -763,12 +763,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/CycleNeuron.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -1669,12 +1669,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/CyclePost.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -905,12 +905,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/DWtFromDiSyn.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -764,12 +764,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/DWtSubMeanNeuron.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -799,12 +799,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
6 changes: 3 additions & 3 deletions axon/shaders/DWtSyn.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,8 @@ fn PathParams_SynCa(pt: PathParams, ctx: Context, si: u32,ri: u32,di: u32, syCaP
cp += sp * GlobalScalars[Index2D(TensorStrides[100], TensorStrides[101], u32(GvCaBinWts + GlobalScalarVars(i)), u32(0))];
cd += sp * GlobalScalars[Index2D(TensorStrides[100], TensorStrides[101], u32(cadSt + GlobalScalarVars(i)), u32(0))];
}
*syCaP = pt.Learn.DWt.CaPScale * pt.Learn.DWt.CaScale * cp;
*syCaD = pt.Learn.DWt.CaScale * cd;
*syCaP = pt.Learn.DWt.CaPScale * cp;
*syCaD = cd;
}
fn PathParams_DWtSynCortex(pt: PathParams, ctx: Context, syni: u32,si: u32,ri: u32,lpi: u32,pi: u32,di: u32, isTarget: bool) {
var syCaP: f32;
Expand Down Expand Up @@ -1066,12 +1066,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
fn DWtParams_TrFromCa(tp: DWtParams, tr: f32, ca: f32) -> f32 {
return tr + tp.Dt*(ca-tr);
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/GPUTestWrite.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -765,12 +765,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/GatherSpikes.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -868,12 +868,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/InitGBuffsPath.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/LayerGi.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -860,12 +860,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/MinusPhaseNeuron.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -767,12 +767,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/MinusPhasePool.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -785,12 +785,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/MinusPhasePost.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -864,12 +864,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/NewStateLayer.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -816,12 +816,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/NewStateNeuron.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -860,12 +860,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
2 changes: 1 addition & 1 deletion axon/shaders/PlusPhaseNeuron.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -865,12 +865,12 @@ struct LRateParams {
struct DWtParams {
Trace: i32,
Tau: f32,
CaScale: f32,
CaPScale: f32,
SubMean: f32,
LearnThr: f32,
Dt: f32,
pad: f32,
pad1: f32,
}
struct HebbParams {
On: i32,
Expand Down
Loading

0 comments on commit b095ae1

Please sign in to comment.