Skip to content

Commit

Permalink
pvlv initial conversion -- needs stats; fixed netview cycles for all
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Dec 19, 2024
1 parent 7472087 commit 5e99617
Show file tree
Hide file tree
Showing 26 changed files with 662 additions and 712 deletions.
30 changes: 15 additions & 15 deletions axon/rubicon-net.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ func (nt *Network) ConnectToSC1to1(send, recv *Layer) *Path {
// from Global Drive.Drives.
// Uses a PopCode representation based on LayerParams.Act.PopCode, distributed over
// given numbers of neurons in the X and Y dimensions, per drive pool.
func (nt *Network) AddDrivesLayer(ctx *Context, nNeurY, nNeurX int) *Layer {
func (nt *Network) AddDrivesLayer(nNeurY, nNeurX int) *Layer {
nix := nt.NetIxs()
drv := nt.AddLayer4D("Drives", DrivesLayer, 1, int(nix.RubiconNPosUSs), nNeurY, nNeurX)
return drv
Expand All @@ -499,8 +499,8 @@ func (nt *Network) AddDrivesLayer(ctx *Context, nNeurY, nNeurX int) *Layer {
// Uses a PopCode representation based on LayerParams.Act.PopCode, distributed over
// given numbers of neurons in the X and Y dimensions, per drive pool.
// Adds Pulvinar predictive layers for Drives.
func (nt *Network) AddDrivesPulvLayer(ctx *Context, nNeurY, nNeurX int, space float32) (drv, drvP *Layer) {
drv = nt.AddDrivesLayer(ctx, nNeurY, nNeurX)
func (nt *Network) AddDrivesPulvLayer(nNeurY, nNeurX int, space float32) (drv, drvP *Layer) {
drv = nt.AddDrivesLayer(nNeurY, nNeurX)
drvP = nt.AddPulvForLayer(drv, space)
drvP.AddDefaultParams(func(ly *LayerParams) {
ly.Inhib.ActAvg.Nominal = 0.01
Expand Down Expand Up @@ -534,12 +534,12 @@ func (nt *Network) AddUrgencyLayer(nNeurY, nNeurX int) *Layer {
// valences -- this is what the dopamine value ends up conding (pos - neg).
// Layers are organized in depth per type: USs in one column, PVs in the next,
// with Drives in the back; urgency behind that.
func (nt *Network) AddRubiconPulvLayers(ctx *Context, nYneur, popY, popX int, space float32) (drives, drivesP, urgency, usPos, usNeg, cost, costFinal, usPosP, usNegP, costP, pvPos, pvNeg, pvPosP, pvNegP *Layer) {
func (nt *Network) AddRubiconPulvLayers(nYneur, popY, popX int, space float32) (drives, drivesP, urgency, usPos, usNeg, cost, costFinal, usPosP, usNegP, costP, pvPos, pvNeg, pvPosP, pvNegP *Layer) {
rel := relpos.Behind

usPos, usNeg, cost, costFinal, usPosP, usNegP, costP = nt.AddUSPulvLayers(popY, popX, rel, space)
pvPos, pvNeg, pvPosP, pvNegP = nt.AddPVPulvLayers(popY, popX, rel, space)
drives, drivesP = nt.AddDrivesPulvLayer(ctx, popY, popX, space)
drives, drivesP = nt.AddDrivesPulvLayer(popY, popX, space)
urgency = nt.AddUrgencyLayer(popY, popX)

pvPos.PlaceRightOf(usPos, space)
Expand All @@ -551,7 +551,7 @@ func (nt *Network) AddRubiconPulvLayers(ctx *Context, nYneur, popY, popX int, sp
// AddOFCpos adds orbital frontal cortex positive US-coding layers,
// for given number of pos US pools (first is novelty / curiosity pool),
// with given number of units per pool.
func (nt *Network) AddOFCpos(ctx *Context, nUSs, nY, ofcY, ofcX int, space float32) (ofc, ofcCT, ofcPT, ofcPTp, ofcMD *Layer) {
func (nt *Network) AddOFCpos(nUSs, nY, ofcY, ofcX int, space float32) (ofc, ofcCT, ofcPT, ofcPTp, ofcMD *Layer) {
ofc, ofcCT, ofcPT, ofcPTp, ofcMD = nt.AddPFC4D("OFCpos", "MD", 1, nUSs, ofcY, ofcX, true, true, space)
ofc.AddDefaultParams(func(ly *LayerParams) { ly.Inhib.Pool.Gi = 1 })
ofcPT.AddDefaultParams(func(ly *LayerParams) { ly.Inhib.ActAvg.Nominal = 0.02 })
Expand All @@ -569,7 +569,7 @@ func (nt *Network) AddOFCpos(ctx *Context, nUSs, nY, ofcY, ofcX int, space float

// AddOFCneg adds orbital frontal cortex negative US-coding layers,
// for given number of neg US pools with given number of units per pool.
func (nt *Network) AddOFCneg(ctx *Context, nUSs, ofcY, ofcX int, space float32) (ofc, ofcCT, ofcPT, ofcPTp, ofcMD *Layer) {
func (nt *Network) AddOFCneg(nUSs, ofcY, ofcX int, space float32) (ofc, ofcCT, ofcPT, ofcPTp, ofcMD *Layer) {
ofc, ofcCT, ofcPT, ofcPTp, ofcMD = nt.AddPFC4D("OFCneg", "MD", 1, nUSs, ofcY, ofcX, true, true, space)

ofc.AddDefaultParams(func(ly *LayerParams) { ly.Inhib.Pool.Gi = 1 })
Expand All @@ -587,7 +587,7 @@ func (nt *Network) AddOFCneg(ctx *Context, nUSs, ofcY, ofcX int, space float32)
// AddACCost adds anterior cingulate cost coding layers,
// for given number of cost pools (typically 2: time, effort),
// with given number of units per pool.
func (nt *Network) AddACCost(ctx *Context, nCosts, accY, accX int, space float32) (acc, accCT, accPT, accPTp, accMD *Layer) {
func (nt *Network) AddACCost(nCosts, accY, accX int, space float32) (acc, accCT, accPT, accPTp, accMD *Layer) {
acc, accCT, accPT, accPTp, accMD = nt.AddPFC4D("ACCcost", "MD", 1, nCosts, accY, accX, true, true, space)

acc.AddDefaultParams(func(ly *LayerParams) { ly.Inhib.Layer.On.SetBool(false) }) // no match
Expand Down Expand Up @@ -625,7 +625,7 @@ func (nt *Network) AddACCost(ctx *Context, nCosts, accY, accX int, space float32
// Makes all appropriate interconnections and sets default parameters.
// Needs CS -> BLA, OFC connections to be made.
// Returns layers most likely to be used for remaining connections and positions.
func (nt *Network) AddRubiconOFCus(ctx *Context, nYneur, popY, popX, bgY, bgX, ofcY, ofcX int, space float32) (vSgpi, vSmtxGo, vSmtxNo, vSpatchD1, vSpatchD2, urgency, usPos, pvPos, usNeg, usNegP, pvNeg, pvNegP, blaPosAcq, blaPosExt, blaNegAcq, blaNegExt, blaNov, ofcPos, ofcPosCT, ofcPosPT, ofcPosPTp, ilPos, ilPosCT, ilPosPT, ilPosPTp, ilPosMD, ofcNeg, ofcNegCT, ofcNegPT, ofcNegPTp, accCost, accCostCT, accCostPT, accCostPTp, accCostMD, ilNeg, ilNegCT, ilNegPT, ilNegPTp, ilNegMD, sc *Layer) {
func (nt *Network) AddRubiconOFCus(nYneur, popY, popX, bgY, bgX, ofcY, ofcX int, space float32) (vSgpi, vSmtxGo, vSmtxNo, vSpatchD1, vSpatchD2, urgency, usPos, pvPos, usNeg, usNegP, pvNeg, pvNegP, blaPosAcq, blaPosExt, blaNegAcq, blaNegExt, blaNov, ofcPos, ofcPosCT, ofcPosPT, ofcPosPTp, ilPos, ilPosCT, ilPosPT, ilPosPTp, ilPosMD, ofcNeg, ofcNegCT, ofcNegPT, ofcNegPTp, accCost, accCostCT, accCostPT, accCostPTp, accCostMD, ilNeg, ilNegCT, ilNegPT, ilNegPTp, ilNegMD, sc *Layer) {
nUSpos := int(nt.Rubicon.NPosUSs)
nUSneg := int(nt.Rubicon.NNegUSs)
nCosts := int(nt.Rubicon.NCosts)
Expand All @@ -634,7 +634,7 @@ func (nt *Network) AddRubiconOFCus(ctx *Context, nYneur, popY, popX, bgY, bgX, o
_ = lhb
_ = ldt

drives, drivesP, urgency, usPos, usNeg, cost, costFinal, usPosP, usNegP, costP, pvPos, pvNeg, pvPosP, pvNegP := nt.AddRubiconPulvLayers(ctx, nYneur, popY, popX, space)
drives, drivesP, urgency, usPos, usNeg, cost, costFinal, usPosP, usNegP, costP, pvPos, pvNeg, pvPosP, pvNegP := nt.AddRubiconPulvLayers(nYneur, popY, popX, space)
_ = urgency

vSmtxGo, vSmtxNo, vSgpePr, vSgpeAk, vSstn, vSgpi := nt.AddVBG("", 1, nUSpos, bgY, bgX, bgY, bgX, space)
Expand All @@ -650,10 +650,10 @@ func (nt *Network) AddRubiconOFCus(ctx *Context, nYneur, popY, popX, bgY, bgX, o
blaPosAcq, blaPosExt, blaNegAcq, blaNegExt, cemPos, cemNeg, blaNov := nt.AddAmygdala("", true, ofcY, ofcX, space)
_, _, _, _, _ = blaNegAcq, blaNegExt, cemPos, cemNeg, blaNov

ofcPos, ofcPosCT, ofcPosPT, ofcPosPTp, ofcPosMD := nt.AddOFCpos(ctx, nUSpos, nYneur, ofcY, ofcX, space)
ofcPos, ofcPosCT, ofcPosPT, ofcPosPTp, ofcPosMD := nt.AddOFCpos(nUSpos, nYneur, ofcY, ofcX, space)
_ = ofcPosPT

ofcNeg, ofcNegCT, ofcNegPT, ofcNegPTp, ofcNegMD := nt.AddOFCneg(ctx, nUSneg, ofcY, ofcX, space)
ofcNeg, ofcNegCT, ofcNegPT, ofcNegPTp, ofcNegMD := nt.AddOFCneg(nUSneg, ofcY, ofcX, space)
_ = ofcNegPT

ilPos, ilPosCT, ilPosPT, ilPosPTp, ilPosMD = nt.AddPFC2D("ILpos", "MD", ofcY, ofcX, true, true, space)
Expand All @@ -665,7 +665,7 @@ func (nt *Network) AddRubiconOFCus(ctx *Context, nYneur, popY, popX, bgY, bgX, o
ilPosPT.AddDefaultParams(func(ly *LayerParams) { ly.Acts.Dend.ModACh.SetBool(true) })
ilNegPT.AddDefaultParams(func(ly *LayerParams) { ly.Acts.Dend.ModACh.SetBool(true) })

accCost, accCostCT, accCostPT, accCostPTp, accCostMD = nt.AddACCost(ctx, nCosts, ofcY, ofcX, space)
accCost, accCostCT, accCostPT, accCostPTp, accCostMD = nt.AddACCost(nCosts, ofcY, ofcX, space)
_ = accCostPT

p1to1 := paths.NewPoolOneToOne()
Expand Down Expand Up @@ -1005,12 +1005,12 @@ func (nt *Network) AddRubiconOFCus(ctx *Context, nYneur, popY, popX, bgY, bgX, o
// Makes all appropriate interconnections and sets default parameters.
// Needs CS -> BLA, OFC connections to be made.
// Returns layers most likely to be used for remaining connections and positions.
func (nt *Network) AddRubicon(ctx *Context, nYneur, popY, popX, bgY, bgX, pfcY, pfcX int, space float32) (vSgpi, vSmtxGo, vSmtxNo, urgency, pvPos, blaPosAcq, blaPosExt, blaNegAcq, blaNegExt, blaNov, ofcPos, ofcPosCT, ofcPosPT, ofcPosPTp, ilPos, ilPosCT, ilPosPT, ilPosPTp, ofcNeg, ofcNegCT, ofcNegPT, ofcNegPTp, ilNeg, ilNegCT, ilNegPT, ilNegPTp, accCost, plUtil, sc *Layer) {
func (nt *Network) AddRubicon(nYneur, popY, popX, bgY, bgX, pfcY, pfcX int, space float32) (vSgpi, vSmtxGo, vSmtxNo, urgency, pvPos, blaPosAcq, blaPosExt, blaNegAcq, blaNegExt, blaNov, ofcPos, ofcPosCT, ofcPosPT, ofcPosPTp, ilPos, ilPosCT, ilPosPT, ilPosPTp, ofcNeg, ofcNegCT, ofcNegPT, ofcNegPTp, ilNeg, ilNegCT, ilNegPT, ilNegPTp, accCost, plUtil, sc *Layer) {

full := paths.NewFull()
var pt *Path

vSgpi, vSmtxGo, vSmtxNo, vSpatchD1, vSpatchD2, urgency, usPos, pvPos, usNeg, usNegP, pvNeg, pvNegP, blaPosAcq, blaPosExt, blaNegAcq, blaNegExt, blaNov, ofcPos, ofcPosCT, ofcPosPT, ofcPosPTp, ilPos, ilPosCT, ilPosPT, ilPosPTp, ilPosMD, ofcNeg, ofcNegCT, ofcNegPT, ofcNegPTp, accCost, accCostCT, accCostPT, accCostPTp, accCostMD, ilNeg, ilNegCT, ilNegPT, ilNegPTp, ilNegMD, sc := nt.AddRubiconOFCus(ctx, nYneur, popY, popX, bgY, bgX, pfcY, pfcX, space)
vSgpi, vSmtxGo, vSmtxNo, vSpatchD1, vSpatchD2, urgency, usPos, pvPos, usNeg, usNegP, pvNeg, pvNegP, blaPosAcq, blaPosExt, blaNegAcq, blaNegExt, blaNov, ofcPos, ofcPosCT, ofcPosPT, ofcPosPTp, ilPos, ilPosCT, ilPosPT, ilPosPTp, ilPosMD, ofcNeg, ofcNegCT, ofcNegPT, ofcNegPTp, accCost, accCostCT, accCostPT, accCostPTp, accCostMD, ilNeg, ilNegCT, ilNegPT, ilNegPTp, ilNegMD, sc := nt.AddRubiconOFCus(nYneur, popY, popX, bgY, bgX, pfcY, pfcX, space)
_, _, _, _, _, _, _ = usPos, usNeg, usNegP, pvNeg, pvNegP, ilPosCT, ilNegMD
_, _, _ = accCost, accCostCT, accCostPTp
_, _ = blaNegAcq, blaNegExt
Expand Down
3 changes: 2 additions & 1 deletion examples/deep-fsa/deep-fsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ func (ss *Sim) ConfigGUI() {
ss.GUI.CycleUpdateInterval = 10

nv := ss.GUI.AddNetView("Network")
nv.Options.MaxRecs = 300
nv.Options.MaxRecs = 2 * ss.Config.Run.Cycles
nv.Options.Raster.Max = ss.Config.Run.Cycles
nv.SetNet(ss.Net)
ss.TrainUpdate.Config(nv, axon.Theta, ss.StatCounters)
ss.TestUpdate.Config(nv, axon.Theta, ss.StatCounters)
Expand Down
3 changes: 2 additions & 1 deletion examples/deep-move/deep-move.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ func (ss *Sim) ConfigGUI() {
ss.GUI.CycleUpdateInterval = 10

nv := ss.GUI.AddNetView("Network")
nv.Options.MaxRecs = 300
nv.Options.MaxRecs = 2 * ss.Config.Run.Cycles
nv.Options.Raster.Max = ss.Config.Run.Cycles
nv.SetNet(ss.Net)
ss.TrainUpdate.Config(nv, axon.Theta, ss.StatCounters)
ss.TestUpdate.Config(nv, axon.Theta, ss.StatCounters)
Expand Down
3 changes: 2 additions & 1 deletion examples/deep-music/deep-music.go
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ func (ss *Sim) ConfigGUI() {
ss.GUI.CycleUpdateInterval = 10

nv := ss.GUI.AddNetView("Network")
nv.Options.MaxRecs = 300
nv.Options.MaxRecs = 2 * ss.Config.Run.Cycles
nv.Options.Raster.Max = ss.Config.Run.Cycles
nv.SetNet(ss.Net)
ss.TrainUpdate.Config(nv, axon.Theta, ss.StatCounters)
ss.TestUpdate.Config(nv, axon.Theta, ss.StatCounters)
Expand Down
3 changes: 2 additions & 1 deletion examples/inhib/inhib.go
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ func (ss *Sim) ConfigGUI() {
ss.GUI.CycleUpdateInterval = 10

nv := ss.GUI.AddNetView("Network")
nv.Options.MaxRecs = 300
nv.Options.MaxRecs = 2 * ss.Config.Run.Cycles
nv.Options.Raster.Max = ss.Config.Run.Cycles
nv.SetNet(ss.Net)
ss.NetUpdate.Config(nv, axon.Cycle, ss.StatCounters)
ss.GUI.OnStop = func(mode, level enums.Enum) {
Expand Down
5 changes: 3 additions & 2 deletions examples/mpi/mpi.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func (ss *Sim) ConfigLoops() {
})

if ss.Config.GUI {
axon.LooperUpdateNetView(ls, Cycle, Trial, ss.NetViewUpdater, ss.StatCounters)
axon.LooperUpdateNetView(ls, Cycle, Trial, ss.NetViewUpdater)

ls.Stacks[Train].OnInit.Add("GUI-Init", func() { ss.GUI.UpdateWindow() })
ls.Stacks[Test].OnInit.Add("GUI-Init", func() { ss.GUI.UpdateWindow() })
Expand Down Expand Up @@ -692,7 +692,8 @@ func (ss *Sim) ConfigGUI() {
ss.GUI.CycleUpdateInterval = 10

nv := ss.GUI.AddNetView("Network")
nv.Options.MaxRecs = 300
nv.Options.MaxRecs = 2 * ss.Config.Run.Cycles
nv.Options.Raster.Max = ss.Config.Run.Cycles
nv.SetNet(ss.Net)
ss.TrainUpdate.Config(nv, axon.Theta, ss.StatCounters)
ss.TestUpdate.Config(nv, axon.Theta, ss.StatCounters)
Expand Down
3 changes: 2 additions & 1 deletion examples/neuron/neuron.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ func (ss *Sim) ConfigGUI() {
ss.GUI.CycleUpdateInterval = 10

nv := ss.GUI.AddNetView("Network")
nv.Options.MaxRecs = 300
nv.Options.MaxRecs = 2 * ss.Config.Run.Cycles
nv.Options.Raster.Max = ss.Config.Run.Cycles
nv.SetNet(ss.Net)
ss.NetUpdate.Config(nv, axon.Cycle, ss.StatCounters)
ss.GUI.OnStop = func(mode, level enums.Enum) {
Expand Down
3 changes: 2 additions & 1 deletion examples/objrec/objrec.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ func (ss *Sim) ConfigGUI() {
ss.GUI.CycleUpdateInterval = 10

nv := ss.GUI.AddNetView("Network")
nv.Options.MaxRecs = 300
nv.Options.MaxRecs = 2 * ss.Config.Run.Cycles
nv.Options.Raster.Max = ss.Config.Run.Cycles
nv.SetNet(ss.Net)
ss.TrainUpdate.Config(nv, axon.Theta, ss.StatCounters)
ss.TestUpdate.Config(nv, axon.Theta, ss.StatCounters)
Expand Down
22 changes: 11 additions & 11 deletions examples/pcore-ds/pcore-ds.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@ func (ss *Sim) ConfigEnv() {
}

func (ss *Sim) ConfigRubicon(trn *MotorSeqEnv) {
pv := &ss.Net.Rubicon
pv.SetNUSs(2, 1)
pv.Urgency.U50 = 20 // 20 def
rp := &ss.Net.Rubicon
rp.SetNUSs(2, 1)
rp.Urgency.U50 = 20 // 20 def
}

func (ss *Sim) ConfigNet(net *axon.Network) {
Expand Down Expand Up @@ -479,9 +479,9 @@ func (ss *Sim) ApplyInputs(mode Modes) {

// ApplyRubicon applies Rubicon reward inputs
func (ss *Sim) ApplyRubicon(ev *MotorSeqEnv, mode Modes, inRew bool, di uint32) {
pv := &ss.Net.Rubicon
pv.EffortUrgencyUpdate(di, 1)
pv.Urgency.Reset(di)
rp := &ss.Net.Rubicon
rp.EffortUrgencyUpdate(di, 1)
rp.Urgency.Reset(di)

if inRew {
axon.GlobalScalars.Set(1, int(axon.GvACh), int(di))
Expand All @@ -493,13 +493,13 @@ func (ss *Sim) ApplyRubicon(ev *MotorSeqEnv, mode Modes, inRew bool, di uint32)
}

func (ss *Sim) SetRew(rew float32, di uint32) {
pv := &ss.Net.Rubicon
rp := &ss.Net.Rubicon
axon.GlobalSetRew(di, rew, true)
axon.GlobalScalars.Set(rew, int(axon.GvDA), int(di)) // no reward prediction error
if rew > 0 {
pv.SetUS(di, axon.Positive, 0, 1)
rp.SetUS(di, axon.Positive, 0, 1)
} else if rew < 0 {
pv.SetUS(di, axon.Negative, 0, 1)
rp.SetUS(di, axon.Negative, 0, 1)
}
}

Expand Down Expand Up @@ -682,7 +682,6 @@ func (ss *Sim) RunStats(mode Modes, level Levels, phase StatsPhase) {
if phase == Step && ss.GUI.Tabs != nil {
nm := mode.String() + "/" + level.String() + " Plot"
ss.GUI.Tabs.GoUpdatePlot(nm)
ss.GUI.Tabs.GoUpdatePlot("Train/TrialAll Plot")
}
}

Expand Down Expand Up @@ -872,7 +871,8 @@ func (ss *Sim) ConfigGUI() {
ss.GUI.CycleUpdateInterval = 10

nv := ss.GUI.AddNetView("Network")
nv.Options.MaxRecs = 300
nv.Options.MaxRecs = 2 * ss.Config.Run.Cycles
nv.Options.Raster.Max = ss.Config.Run.Cycles
nv.SetNet(ss.Net)
ss.TrainUpdate.Config(nv, axon.Theta, ss.StatCounters)
ss.TestUpdate.Config(nv, axon.Theta, ss.StatCounters)
Expand Down
21 changes: 11 additions & 10 deletions examples/pcore-vs/pcore-vs.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ func (ss *Sim) ConfigEnv() {
}

func (ss *Sim) ConfigRubicon(trn *GoNoEnv) {
pv := &ss.Net.Rubicon
pv.SetNUSs(2, 1)
pv.Urgency.U50 = 20 // 20 def
rp := &ss.Net.Rubicon
rp.SetNUSs(2, 1)
rp.Urgency.U50 = 20 // 20 def
}

func (ss *Sim) ConfigNet(net *axon.Network) {
Expand Down Expand Up @@ -410,10 +410,10 @@ func (ss *Sim) ApplyInputs(mode Modes, trial, theta int) {

// ApplyRubicon applies Rubicon reward inputs
func (ss *Sim) ApplyRubicon(ev *GoNoEnv, mode Modes, trial int, di uint32) {
pv := &ss.Net.Rubicon
pv.EffortUrgencyUpdate(di, 1)
rp := &ss.Net.Rubicon
rp.EffortUrgencyUpdate(di, 1)
if mode == Test {
pv.Urgency.Reset(di)
rp.Urgency.Reset(di)
}

switch trial {
Expand All @@ -437,13 +437,13 @@ func (ss *Sim) GatedRew(ev *GoNoEnv, di uint32) {
}

func (ss *Sim) SetRew(rew float32, di uint32) {
pv := &ss.Net.Rubicon
rp := &ss.Net.Rubicon
axon.GlobalSetRew(di, rew, true)
axon.GlobalScalars.Set(rew, int(axon.GvDA), int(di)) // no reward prediction error
if rew > 0 {
pv.SetUS(di, axon.Positive, 0, 1)
rp.SetUS(di, axon.Positive, 0, 1)
} else if rew < 0 {
pv.SetUS(di, axon.Negative, 0, 1)
rp.SetUS(di, axon.Negative, 0, 1)
}
}

Expand Down Expand Up @@ -713,7 +713,8 @@ func (ss *Sim) ConfigGUI() {
ss.GUI.CycleUpdateInterval = 10

nv := ss.GUI.AddNetView("Network")
nv.Options.MaxRecs = 300
nv.Options.MaxRecs = 2 * ss.Config.Run.Cycles
nv.Options.Raster.Max = ss.Config.Run.Cycles
nv.SetNet(ss.Net)
ss.TrainUpdate.Config(nv, axon.Theta, ss.StatCounters)
ss.TestUpdate.Config(nv, axon.Theta, ss.StatCounters)
Expand Down
File renamed without changes.
11 changes: 6 additions & 5 deletions examples/pfcmaint/pfcmaint.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ func (ss *Sim) ConfigNet(net *axon.Network) {
}

func (ss *Sim) ConfigRubicon() {
pv := &ss.Net.Rubicon
pv.SetNUSs(1, 1)
rp := &ss.Net.Rubicon
rp.SetNUSs(1, 1)
}

func (ss *Sim) ApplyParams() {
Expand Down Expand Up @@ -348,8 +348,8 @@ func (ss *Sim) ApplyInputs(mode Modes, trial, theta int) {

// ApplyRubicon applies Rubicon reward inputs
func (ss *Sim) ApplyRubicon(ev *PFCMaintEnv, mode Modes, trial int, di uint32) {
pv := &ss.Net.Rubicon
pv.NewState(di, &ss.Net.Rand) // first before anything else is updated
rp := &ss.Net.Rubicon
rp.NewState(di, &ss.Net.Rand) // first before anything else is updated
if ev.Trial.Cur == 0 { // reset maint on rew -- trial counter wraps around to 0
axon.GlobalSetRew(di, 1, true)
}
Expand Down Expand Up @@ -567,7 +567,8 @@ func (ss *Sim) ConfigGUI() {
ss.GUI.CycleUpdateInterval = 10

nv := ss.GUI.AddNetView("Network")
nv.Options.MaxRecs = 300
nv.Options.MaxRecs = 2 * ss.Config.Run.Cycles
nv.Options.Raster.Max = ss.Config.Run.Cycles
nv.SetNet(ss.Net)
ss.TrainUpdate.Config(nv, axon.Theta, ss.StatCounters)
ss.TestUpdate.Config(nv, axon.Theta, ss.StatCounters)
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5e99617

Please sign in to comment.