etime

package
v2.0.0-dev0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: BSD-3-Clause Imports: 4 Imported by: 20

README

Docs: GoDoc

Everything is organized according to a ScopeKey, which is just a string, that is formatted to represent two factors: an evaluation mode (standard versions defined by Modes enum) and a time scale (Times enum).

Standard evaluation Modes are:

  • Train
  • Test
  • Validate
  • Analyze -- used for internal representational analysis functions such as PCA, ActRF, SimMat, etc.

Standard Times are based on the Env TimeScales augmented with Leabra / Axon finer-grained scales, including:

  • Run
  • Epoch
  • Trial
  • Phase
  • Cycle

Other arbitrary scope values can be used -- there are Scope versions of every method that take an arbitrary ScopeKey that can be composed using the ScopeStr method from any two strings, along with the "plain" versions of these methods that take the standard mode and time enums for convenience. These enums can themselves also be extended but it is probably easier to just use strings.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ScopeKeySeparator = "&" // between mode and time
	ScopeKeyList      = "|" // between multiple modes, times
)

Like "Train|Test&Epoch|Trial"

Functions

func ScopeName

func ScopeName(mode Modes, time Times) string

ScopeName generates a string name as just the concatenation of mode + time e.g., used for naming log tables

Types

type Modes

type Modes int32 //enums:enum

Modes are evaluation modes (Training, Testing, etc)

const (
	NoEvalMode Modes = iota

	// AllModes indicates that the log should occur over all modes present in other items.
	AllModes

	// Train is when the network is learning
	Train

	// Test is when testing, typically without learning
	Test

	// Validate is typically for a special held-out testing set
	Validate

	// Analyze is when analyzing the representations and behavior of the network
	Analyze

	// Debug is for recording info particularly useful for debugging
	Debug
)

The evaluation modes

const ModesN Modes = 7

ModesN is the highest valid value for type Modes, plus one.

func ModeFromString

func ModeFromString(str string) Modes

ModeFromString returns Mode int value from string name

func ModesValues

func ModesValues() []Modes

ModesValues returns all possible values for the type Modes.

func (Modes) Desc

func (i Modes) Desc() string

Desc returns the description of the Modes value.

func (Modes) Int64

func (i Modes) Int64() int64

Int64 returns the Modes value as an int64.

func (Modes) MarshalText

func (i Modes) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Modes) SetInt64

func (i *Modes) SetInt64(in int64)

SetInt64 sets the Modes value from an int64.

func (*Modes) SetString

func (i *Modes) SetString(s string) error

SetString sets the Modes value from its string representation, and returns an error if the string is invalid.

func (Modes) String

func (i Modes) String() string

String returns the string representation of this Modes value.

func (*Modes) UnmarshalText

func (i *Modes) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Modes) Values

func (i Modes) Values() []enums.Enum

Values returns all possible values for the type Modes.

type ScopeKey

type ScopeKey string

ScopeKey the associated string representation of a scope or scopes. They include one or more Modes and one or more Times. It is fully extensible with arbitrary mode and time strings -- the enums are a convenience for standard cases. Ultimately a single mode, time pair is used concretely, but the All* cases and lists of multiple can be used as a convenience to specify ranges

func CloneScopeSlice

func CloneScopeSlice(ss []ScopeKey) []ScopeKey

CloneScopeSlice returns a copy of given ScopeKey slice

func Scope

func Scope(mode Modes, time Times) ScopeKey

Scope generates a scope key string from one mode and time

func ScopeStr

func ScopeStr(mode, time string) ScopeKey

ScopeStr generates a scope key string from string values for mode, time

func Scopes

func Scopes(modes []Modes, times []Times) ScopeKey

Scopes generates a scope key string from multiple modes, times

func ScopesMap

func ScopesMap(modes, times map[string]bool) ScopeKey

ScopesMap generates a scope key from maps of modes and times (warning: ordering is random!)

func ScopesStr

func ScopesStr(modes, times []string) ScopeKey

ScopesStr generates a scope key string from multiple modes, times

func SortScopes

func SortScopes(scopes []ScopeKey) []ScopeKey

SortScopes sorts a list of concrete mode, time scopes according to the Modes and Times enum ordering

func (*ScopeKey) FromScope

func (sk *ScopeKey) FromScope(mode Modes, time Times)

FromScope create an associated scope from given standard mode and time

func (*ScopeKey) FromScopeStr

func (sk *ScopeKey) FromScopeStr(mode, time string)

FromScopeStr create an associated scope from given mode and time as strings

func (*ScopeKey) FromScopes

func (sk *ScopeKey) FromScopes(modes []Modes, times []Times)

FromScopes creates an associated scope merging the modes and times that are specified If you modify this, also modify ModesAndTimes, below.

func (*ScopeKey) FromScopesMap

func (sk *ScopeKey) FromScopesMap(modes, times map[string]bool)

FromScopesMap creates an associated scope key merging the modes and times that are specified by map of strings.

func (*ScopeKey) FromScopesStr

func (sk *ScopeKey) FromScopesStr(modes, times []string)

FromScopesStr creates an associated scope merging the modes and times that are specified as strings If you modify this, also modify ModesAndTimes, below.

func (*ScopeKey) ModeAndTime

func (sk *ScopeKey) ModeAndTime() (mode Modes, time Times)

ModeAndTime returns the singular mode and time as enums from a concrete scope key having one of each (No* cases if not standard)

func (*ScopeKey) ModeAndTimeStr

func (sk *ScopeKey) ModeAndTimeStr() (mode, time string)

ModeAndTimeStr returns the mode and time as strings from the current key value. Returns the first of each if there are multiple (intended for case when only 1).

func (*ScopeKey) ModesAndTimes

func (sk *ScopeKey) ModesAndTimes() (modes, times []string)

ModesAndTimes returns the mode(s) and time(s) as strings from the current key value. This must be the inverse of FromScopesStr

func (*ScopeKey) ModesAndTimesMap

func (sk *ScopeKey) ModesAndTimesMap() (modes, times map[string]bool)

ModesAndTimesMap returns maps of modes and times as strings parsed from the current scopekey

type Times

type Times int32 //enums:enum

Times the enum

const (
	// NoTime represents a non-initialized value, or a null result
	NoTime Times = iota

	// AllTimes indicates that the log should occur over all times present in other items.
	AllTimes

	// Cycle is the finest time scale -- typically 1 msec -- a single activation update.
	Cycle

	// FastSpike is typically 10 cycles = 10 msec (100hz) = the fastest spiking time
	// generally observed in the brain.  This can be useful for visualizing updates
	// at a granularity in between Cycle and GammaCycle.
	FastSpike

	// GammaCycle is typically 25 cycles = 25 msec (40hz)
	GammaCycle

	// Phase is typically a Minus or Plus phase, where plus phase is bursting / outcome
	// that drives positive learning relative to prediction in minus phase.
	// It can also be used for other time scales involving multiple Cycles.
	Phase

	// BetaCycle is typically 50 cycles = 50 msec (20 hz) = one beta-frequency cycle.
	// Gating in the basal ganglia and associated updating in prefrontal cortex
	// occurs at this frequency.
	BetaCycle

	// AlphaCycle is typically 100 cycles = 100 msec (10 hz) = one alpha-frequency cycle.
	AlphaCycle

	// ThetaCycle is typically 200 cycles = 200 msec (5 hz) = two alpha-frequency cycles.
	// This is the modal duration of a saccade, the update frequency of medial temporal lobe
	// episodic memory, and the minimal predictive learning cycle (perceive an Alpha 1, predict on 2).
	ThetaCycle

	// Event is the smallest unit of naturalistic experience that coheres unto itself
	// (e.g., something that could be described in a sentence).
	// Typically this is on the time scale of a few seconds: e.g., reaching for
	// something, catching a ball.
	Event

	// Trial is one unit of behavior in an experiment -- it is typically environmentally
	// defined instead of endogenously defined in terms of basic brain rhythms.
	// In the minimal case it could be one ThetaCycle, but could be multiple, and
	// could encompass multiple Events (e.g., one event is fixation, next is stimulus,
	// last is response)
	Trial

	// Tick is one step in a sequence -- often it is useful to have Trial count
	// up throughout the entire Epoch but also include a Tick to count trials
	// within a Sequence
	Tick

	// Sequence is a sequential group of Trials (not always needed).
	Sequence

	// Epoch is used in two different contexts.  In machine learning, it represents a
	// collection of Trials, Sequences or Events that constitute a "representative sample"
	// of the environment.  In the simplest case, it is the entire collection of Trials
	// used for training.  In electrophysiology, it is a timing window used for organizing
	// the analysis of electrode data.
	Epoch

	// Block is a collection of Trials, Sequences or Events, often used in experiments
	// when conditions are varied across blocks.
	Block

	// Condition is a collection of Blocks that share the same set of parameters.
	// This is intermediate between Block and Run levels.
	// Aggregation of stats at this level is based on the last 5 rows by default.
	Condition

	// Run is a complete run of a model / subject, from training to testing, etc.
	// Often multiple runs are done in an Expt to obtain statistics over initial
	// random weights etc.
	// Aggregation of stats at this level is based on the last 5 rows by default.
	Run

	// Expt is an entire experiment -- multiple Runs through a given protocol / set of
	// parameters.
	Expt

	// Scene is a sequence of events that constitutes the next larger-scale coherent unit
	// of naturalistic experience corresponding e.g., to a scene in a movie.
	// Typically consists of events that all take place in one location over
	// e.g., a minute or so. This could be a paragraph or a page or so in a book.
	Scene

	// Episode is a sequence of scenes that constitutes the next larger-scale unit
	// of naturalistic experience e.g., going to the grocery store or eating at a
	// restaurant, attending a wedding or other "event".
	// This could be a chapter in a book.
	Episode
)

A list of predefined time scales at which logging can occur

const TimesN Times = 20

TimesN is the highest valid value for type Times, plus one.

func TimeFromString

func TimeFromString(str string) Times

TimeFromString returns Time int value from string name

func TimesValues

func TimesValues() []Times

TimesValues returns all possible values for the type Times.

func (Times) Desc

func (i Times) Desc() string

Desc returns the description of the Times value.

func (Times) Int64

func (i Times) Int64() int64

Int64 returns the Times value as an int64.

func (Times) MarshalText

func (i Times) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Times) SetInt64

func (i *Times) SetInt64(in int64)

SetInt64 sets the Times value from an int64.

func (*Times) SetString

func (i *Times) SetString(s string) error

SetString sets the Times value from its string representation, and returns an error if the string is invalid.

func (Times) String

func (i Times) String() string

String returns the string representation of this Times value.

func (*Times) UnmarshalText

func (i *Times) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Times) Values

func (i Times) Values() []enums.Enum

Values returns all possible values for the type Times.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL