Skip to content

Commit

Permalink
bgdorsal: rest of stats, stopping crit etc
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Dec 21, 2024
1 parent 45e22c7 commit 1493e8f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
38 changes: 34 additions & 4 deletions sims/bgdorsal/bg-dorsal.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ func (ss *Sim) ConfigLoops() {
ls.Loop(Train, Run).OnStart.Add("NewRun", ss.NewRun)

ls.Loop(Train, Epoch).IsDone.AddBool("StopCrit", func() bool {
curModeDir := ss.Current.Dir(Train.String())
rew := curModeDir.Value("RewEpc").Float1D(-1)
epcDir := ss.Stats.Dir(Train.String()).Dir(Epoch.String())
rew := epcDir.Value("Rew").Float1D(-1)
stop := rew >= 0.98
return stop
})
Expand Down Expand Up @@ -785,7 +785,7 @@ func (ss *Sim) ConfigStats() {
}
})

seqStats := []string{"NCorrect", "Rew", "RewPred", "RPE", "RewEpc"}
seqStats := []string{"NCorrect", "Rew", "RewPred", "RPE"}
ss.AddStat(func(mode Modes, level Levels, phase StatsPhase) {
if level <= Trial {
return
Expand Down Expand Up @@ -824,12 +824,42 @@ func (ss *Sim) ConfigStats() {
curModeDir.Float32(name, ndata).SetFloat1D(float64(stat), di)
tsr.AppendRowFloat(float64(stat))
}
default:
case Epoch:
stat = stats.StatMean.Call(subDir.Value(name)).Float1D(0)
tsr.AppendRowFloat(stat)
default: // Run, Expt
stat = stats.StatFinal.Call(subDir.Value(name)).Float1D(0)

Check failure on line 831 in sims/bgdorsal/bg-dorsal.go

View workflow job for this annotation

GitHub Actions / build

undefined: stats.StatFinal
tsr.AppendRowFloat(stat)
}
}
})
ss.AddStat(func(mode Modes, level Levels, phase StatsPhase) {
if level <= Epoch {
return
}
name := "EpochsToCrit"
modeDir := ss.Stats.Dir(mode.String())
levelDir := modeDir.Dir(level.String())
subDir := modeDir.Dir((level - 1).String()) // note: will fail for Cycle
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
}
var stat float64
switch level {
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)

Check failure on line 859 in sims/bgdorsal/bg-dorsal.go

View workflow job for this annotation

GitHub Actions / build

undefined: stats.StatFinal
tsr.AppendRowFloat(stat)
}
})
}

// StatCounters returns counters string to show at bottom of netview.
Expand Down
2 changes: 1 addition & 1 deletion sims/bgdorsal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type RunConfig struct {
Runs int `default:"25" min:"1"`

// Epochs is the total number of epochs per run.
Epochs int `default:"50"`
Epochs int `default:"100"`

// Sequences is the total number of sequences per epoch.
// Should be an even multiple of NData.
Expand Down

0 comments on commit 1493e8f

Please sign in to comment.