Skip to content

Commit

Permalink
bgdorsal: updated best params
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Jan 11, 2025
1 parent 4cbeac3 commit 52bfbf8
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 10 deletions.
36 changes: 32 additions & 4 deletions sims/bgdorsal/bg-dorsal.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"cogentcore.org/core/cli"
"cogentcore.org/core/core"
"cogentcore.org/core/enums"
"cogentcore.org/core/gpu"
"cogentcore.org/core/icons"
"cogentcore.org/core/math32"
"cogentcore.org/core/tree"
Expand Down Expand Up @@ -326,7 +327,6 @@ func (ss *Sim) ConfigNet(net *axon.Network) {
net.SetNThreads(ss.Config.Run.NThreads)
ss.ApplyParams()
net.InitWeights()
fmt.Println("m1:", m1.Index)
}

func (ss *Sim) ApplyParams() {
Expand Down Expand Up @@ -889,15 +889,42 @@ func (ss *Sim) ConfigStats() {
case Run:
stat = float64(ss.Loops.Loop(mode, (level - 1)).Counter.Cur)
tsr.AppendRowFloat(stat)
default: // in case higher
stat = stats.StatFinal.Call(subDir.Value(name)).Float1D(0)
default: // expt
stat = stats.StatMean.Call(subDir.Value(name)).Float1D(0)
tsr.AppendRowFloat(stat)
}
})
ss.AddStat(func(mode Modes, level Levels, phase StatsPhase) {
if level < Expt {
return
}
name := "NFail"
modeDir := ss.Stats.Dir(mode.String())
levelDir := modeDir.Dir(level.String())
subDir := modeDir.Dir((level - 1).String())
tsr := levelDir.Float64(name)
if phase == Start {
tsr.SetNumRows(0)
plot.SetFirstStylerTo(tsr, func(s *plot.Style) {
s.Range.SetMin(0)
s.On = true
})
return
}
run := subDir.Value("EpochsToCrit")
nfail := 0
for i := range run.Len() {
epc := run.Float1D(i)
if int(epc) == ss.Config.Run.Epochs {
nfail++
}
}
tsr.AppendRowFloat(float64(nfail))
})
runAllFunc := axon.StatLevelAll(ss.Stats, Train, Run, func(s *plot.Style, cl tensor.Values) {
name := metadata.Name(cl)
switch name {
case "FirstZero", "LastZero":
case "EpochsToCrit", "NCorrect":
s.On = true
s.Range.SetMin(0)
}
Expand Down Expand Up @@ -990,6 +1017,7 @@ func (ss *Sim) RunGUI() {
}

func (ss *Sim) RunNoGUI() {
gpu.DebugAdapter = true
ss.Init()

if ss.Config.Params.Note != "" {
Expand Down
2 changes: 1 addition & 1 deletion sims/bgdorsal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ type LogConfig struct {
SaveWeights bool

// Train has the list of Train mode levels to save log files for.
Train []string `default:"['Run', 'Epoch']" nest:"+"`
Train []string `default:"['Expt', 'Run', 'Epoch']" nest:"+"`

// Test has the list of Test mode levels to save log files for.
Test []string `nest:"+"`
Expand Down
36 changes: 31 additions & 5 deletions sims/bgdorsal/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ var LayerParams = axon.LayerSheets{
}},
{Sel: ".PFCLayer", Doc: "pfc",
Set: func(ly *axon.LayerParams) {
ly.Learn.NeuroMod.DAMod = axon.NoDAMod
ly.Learn.NeuroMod.DAModGain = 0.01
ly.Learn.NeuroMod.DAMod = axon.NoDAMod // D1Mod
ly.Learn.NeuroMod.DAModGain = 0.005 // 0.005 > higher
ly.Learn.NeuroMod.DipGain = 0 // 0 > higher
ly.Learn.RLRate.SigmoidLinear.SetBool(false)
}},
{Sel: ".MatrixLayer", Doc: "all mtx",
Set: func(ly *axon.LayerParams) {
Expand Down Expand Up @@ -66,11 +68,21 @@ var LayerParams = axon.LayerSheets{
}},
{Sel: "#MotorBS", Doc: "",
Set: func(ly *axon.LayerParams) {
ly.Learn.NeuroMod.DAMod = axon.D1Mod // definitely beneficial here!
ly.Learn.NeuroMod.DAModGain = 0.03 // up to 0.04 good
ly.Learn.NeuroMod.DipGain = 0.1 // 0.1 > 0 > 0.2
ly.Inhib.Layer.On.SetBool(true)
ly.Inhib.Pool.On.SetBool(false)
ly.Inhib.Layer.Gi = 0.2 // 0.2 def
ly.Acts.Clamp.Ge = 2 // 2 > 1.5, >> 1 -- absolutely critical given GPi inhib
}},
{Sel: "#VL", Doc: "",
Set: func(ly *axon.LayerParams) {
// not obviously beneficial here
// ly.Learn.NeuroMod.DAMod = axon.D1Mod
// ly.Learn.NeuroMod.DAModGain = 0.02
// ly.Learn.NeuroMod.DipGain = 0 // 0 > higher
}},
{Sel: "#DGPeAk", Doc: "arkypallidal",
Set: func(ly *axon.LayerParams) {
ly.Acts.Init.GeBase = 0.2 // 0.2 > 0.3, 0.1
Expand All @@ -92,7 +104,7 @@ var PathParams = axon.PathSheets{
{Sel: "Path", Doc: "",
Set: func(pt *axon.PathParams) {
pt.Learn.LRate.Base = 0.04 // 0.04 def -- works best
pt.Learn.DWt.CaPScale = 0.95 // 0.95 > 1 or .9
pt.Learn.DWt.CaPScale = 0.95 // normal default for most cases
pt.Learn.DWt.Tau = 1 // 1 > 2
}},
{Sel: ".CTtoPred", Doc: "",
Expand Down Expand Up @@ -156,11 +168,25 @@ var PathParams = axon.PathSheets{
}},
{Sel: "#DGPiToMotorBS", Doc: "final inhibition",
Set: func(pt *axon.PathParams) {
pt.PathScale.Abs = 3 // 3 > 2.5, 3.5
pt.PathScale.Abs = 3 // 3 > 2.5, 3.5
pt.Learn.DWt.CaPScale = 1.2 // only relevant here
pt.Learn.LRate.Base = 0.02 // 0.02 > 0.03 > 0.01 > 0.04
}},
{Sel: ".M1ToMotorBS", Doc: "",
Set: func(pt *axon.PathParams) {
pt.PathScale.Abs = 2 // 2 > 1.5, 2.5
pt.PathScale.Abs = 2 // 2 > 1.5, 2.5
pt.Learn.DWt.CaPScale = 1.2 // only relevant here
pt.Learn.LRate.Base = 0.02
}},
{Sel: ".VLM1", Doc: "",
Set: func(pt *axon.PathParams) {
pt.Learn.DWt.CaPScale = 1.2 // only relevant here
pt.Learn.LRate.Base = 0.02
}},
{Sel: ".ToVL", Doc: "",
Set: func(pt *axon.PathParams) {
pt.Learn.DWt.CaPScale = 1.2 // only relevant here
pt.Learn.LRate.Base = 0.02
}},
{Sel: "#M1PTToMotorBS", Doc: "",
Set: func(pt *axon.PathParams) {
Expand Down

0 comments on commit 52bfbf8

Please sign in to comment.