Skip to content

Commit

Permalink
params aliases and misc param updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Jan 7, 2025
1 parent a916850 commit d5c63d3
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 24 deletions.
35 changes: 25 additions & 10 deletions axon/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,26 @@ import (
"github.com/emer/emergent/v2/params"
)

// LayerSheets are Layer parameter Sheets.
type LayerSheets = params.Sheets[*LayerParams]
// type aliases for params generic types that we use:
type (
// LayerSheets contains Layer parameter Sheets.
LayerSheets = params.Sheets[*LayerParams]

// PathSheets are Path parameter Sheets.
type PathSheets = params.Sheets[*PathParams]
// LayerSheet is one Layer parameter Sheet.
LayerSheet = params.Sheet[*LayerParams]

// LayerSel is one Layer parameter Selector.
LayerSel = params.Sel[*LayerParams]

// PathSheets contains Path parameter Sheets.
PathSheets = params.Sheets[*PathParams]

// PathSheet is one Path parameter Sheet.
PathSheet = params.Sheet[*PathParams]

// PathSel is one Path parameter Selector.
PathSel = params.Sel[*PathParams]
)

// Params contains the [LayerParams] and [PathParams] parameter setting functions
// provided by the [emergent] [params] package.
Expand Down Expand Up @@ -83,14 +98,14 @@ func (pr *Params) Config(layer LayerSheets, path PathSheets, extraSheets, tag st
pr.Interp = interp.New(interp.Options{})
pr.Interp.Use(interp.Exports{
"github.com/emer/axon/axon": map[string]reflect.Value{
"LayerSel": reflect.ValueOf((*params.Sel[*LayerParams])(nil)),
"LayerSheet": reflect.ValueOf((*params.Sheet[*LayerParams])(nil)),
"PathSel": reflect.ValueOf((*params.Sel[*PathParams])(nil)),
"PathSheet": reflect.ValueOf((*params.Sheet[*PathParams])(nil)),
"LayerSheets": reflect.ValueOf((*LayerSheets)(nil)),
"PathSheets": reflect.ValueOf((*PathSheets)(nil)),
"LayerParams": reflect.ValueOf((*LayerParams)(nil)),
"PathParams": reflect.ValueOf((*PathParams)(nil)),
"LayerSel": reflect.ValueOf((*LayerSel)(nil)),
"LayerSheet": reflect.ValueOf((*LayerSheet)(nil)),
"LayerSheets": reflect.ValueOf((*LayerSheets)(nil)),
"PathSel": reflect.ValueOf((*PathSel)(nil)),
"PathSheet": reflect.ValueOf((*PathSheet)(nil)),
"PathSheets": reflect.ValueOf((*PathSheets)(nil)),
},
"github.com/emer/axon/sim/sim": map[string]reflect.Value{
"Sim": sim,
Expand Down
4 changes: 3 additions & 1 deletion sims/bgdorsal/bg-dorsal.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,9 @@ func (ss *Sim) ConfigStats() {
tsr.SetNumRows(0)
plot.SetFirstStylerTo(tsr, func(s *plot.Style) {
s.Range.SetMin(0).SetMax(1)
s.On = true
if name != "RT" {
s.On = true
}
})
continue
}
Expand Down
2 changes: 1 addition & 1 deletion sims/bgdorsal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ type LogConfig struct {
type Config struct {

// Name is the short name of the sim.
Name string `display:"-" default:"PCoreDS"`
Name string `display:"-" default:"BGDorsal"`

// Title is the longer title of the sim.
Title string `display:"-" default:"Pallidal Core (GPe) Dorsal Striatum"`
Expand Down
17 changes: 11 additions & 6 deletions sims/bgdorsal/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ var LayerParams = axon.LayerSheets{
Set: func(ly *axon.LayerParams) {
ly.Acts.Clamp.Ge = 1.0 // 1.5 is def, was 0.6 (too low)
ly.Acts.Noise.On.SetBool(true)
ly.Acts.Noise.Ge = 0.0001 // 0.0001 > others; could just be noise ;)
ly.Acts.Noise.Gi = 0.0001 // 0.0001 perhaps better than others
ly.Learn.RLRate.SigmoidLinear.SetBool(false) // ?
ly.Acts.Noise.Ge = 0.0001 // 0.0001 > others; could just be noise ;)
ly.Acts.Noise.Gi = 0.0001 // 0.0001 perhaps better than others
ly.Learn.RLRate.SigmoidLinear.SetBool(false)
}},
{Sel: ".PFCLayer", Doc: "pfc",
Set: func(ly *axon.LayerParams) {
ly.Learn.NeuroMod.DAMod = axon.NoDAMod
ly.Learn.NeuroMod.DAModGain = 0.01
}},
{Sel: ".MatrixLayer", Doc: "all mtx",
Set: func(ly *axon.LayerParams) {
Expand Down Expand Up @@ -86,9 +91,9 @@ var PathParams = axon.PathSheets{
"Base": {
{Sel: "Path", Doc: "",
Set: func(pt *axon.PathParams) {
pt.Learn.LRate.Base = 0.04 // 0.04 def
pt.Learn.DWt.CaPScale = 0.95
pt.Learn.DWt.CaScale = .5 // 0.5 for CaBinCycles = 10
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.Tau = 1 // 1 > 2
}},
{Sel: ".CTtoPred", Doc: "",
Set: func(pt *axon.PathParams) {
Expand Down
7 changes: 3 additions & 4 deletions sims/objrec/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,12 @@ var PathParams = axon.PathSheets{
"Base": {
{Sel: "Path", Doc: "yes extra learning factors",
Set: func(pt *axon.PathParams) {
pt.Learn.LRate.Base = 0.02 // 0.4 for NeuronCa; 0.2 best, 0.1 nominal
pt.Learn.LRate.Base = 0.2 // 0.4 for NeuronCa; 0.2 best, 0.1 nominal
pt.Learn.DWt.SubMean = 1 // 1 -- faster if 0 until 20 epc -- prevents sig amount of late deterioration
pt.SWts.Adapt.LRate = 0.0001 // 0.005 == .1 == .01
pt.SWts.Init.SPct = 1 // 1 >= lower (trace-v11)
pt.Learn.DWt.CaPScale = 1 // trace: 0.95 resists late hogging
// pt.Learn.DWt.CaScale = 0.5 // 0.5 for CaBinCycles = 10
pt.Learn.DWt.Trace.SetBool(false) // no trace is faster!
pt.Learn.DWt.CaPScale = 0.95 // trace: 0.95 resists late hogging
// pt.Learn.DWt.Trace.SetBool(false) // no trace is faster!
}},
{Sel: ".BackPath", Doc: "top-down back-pathways MUST have lower relative weight scale, otherwise network hallucinates -- smaller as network gets bigger",
Set: func(pt *axon.PathParams) {
Expand Down
7 changes: 5 additions & 2 deletions sims/ra25/ra25.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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 All @@ -43,8 +44,6 @@ import (
var content embed.FS

func main() {
// gpu.Debug = true
// gpu.DebugAdapter = true
cfg := &Config{}
cli.SetFromDefaults(cfg)
opts := cli.DefaultOptions(cfg.Name, cfg.Title)
Expand Down Expand Up @@ -132,6 +131,10 @@ type Sim struct {
func RunSim(cfg *Config) error {
sim := &Sim{}
sim.Config = cfg
if cfg.Debug {
gpu.Debug = true
gpu.DebugAdapter = true
}
sim.Run()
return nil
}
Expand Down

0 comments on commit d5c63d3

Please sign in to comment.