Versions in this module Expand all Collapse all v0 v0.1.1 May 13, 2023 Changes in this version + var DefaultActorConfig = &ModelConfig + var DefaultActorLayerBuilder = func(env *envv1.Env) []layer.Config + var DefaultAgentConfig = &AgentConfig + var DefaultCriticConfig = &ModelConfig + var DefaultCriticLayerBuilder = func(env *envv1.Env) []layer.Config + var DefaultHyperparameters = &Hyperparameters + func GAE(values, masks, rewards []*t.Dense, gamma, lambda float32) (returns, advantage *t.Dense, err error) + func MakeActor(config *ModelConfig, base *agentv1.Base, env *envv1.Env) (modelv1.Model, error) + func MakeCritic(config *ModelConfig, base *agentv1.Base, env *envv1.Env) (modelv1.Model, error) + func WithClip(val float64) func(*Loss) + func WithCriticDiscount(val float32) func(*Loss) + func WithEntropyBeta(val float32) func(*Loss) + type Agent struct + Actor modelv1.Model + Critic modelv1.Model + Memory *Memory + func NewAgent(c *AgentConfig, env *envv1.Env) (*Agent, error) + func (a *Agent) Action(state *tensor.Dense) (action int, event *Event, err error) + func (a *Agent) Learn(event *Event) error + type AgentConfig struct + ActorConfig *ModelConfig + Base *agentv1.Base + CriticConfig *ModelConfig + type BatchedEvents struct + ActionOneHots *tensor.Dense + ActionProbs *tensor.Dense + Len int + Masks *tensor.Dense + QValues *tensor.Dense + Rewards *tensor.Dense + States *tensor.Dense + type Event struct + ActionOneHot *tensor.Dense + ActionProbs *tensor.Dense + Mask *tensor.Dense + QValue *tensor.Dense + Reward *tensor.Dense + State *tensor.Dense + func NewEvent(state, actionProbs, actionOneHot, qValue *tensor.Dense) *Event + func (e *Event) Apply(outcome *envv1.Outcome) + type Events struct + ActionOneHots []*tensor.Dense + ActionProbs []*tensor.Dense + Masks []*tensor.Dense + QValues []*tensor.Dense + Rewards []*tensor.Dense + States []*tensor.Dense + func (e *Events) Batch() (events *BatchedEvents, err error) + type Hyperparameters struct + Gamma float32 + Lambda float32 + type LayerBuilder func(env *envv1.Env) []layer.Config + type Loss struct + func NewLoss(oldProbs, advantages, rewards, values *modelv1.Input, opts ...LossOpt) *Loss + func (l *Loss) CloneTo(graph *g.ExprGraph, opts ...modelv1.CloneOpt) modelv1.Loss + func (l *Loss) Compute(yHat, y *g.Node) (loss *g.Node, err error) + func (l *Loss) Inputs() modelv1.Inputs + type LossOpt func(*Loss) + type Memory struct + func NewMemory() *Memory + func (m *Memory) Len() int + func (m *Memory) Pop() (e *Events) + func (m *Memory) Remember(event *Event) error + func (m *Memory) Reset() + type ModelConfig struct + BatchSize int + LayerBuilder LayerBuilder + Loss modelv1.Loss + Optimizer g.Solver + Track bool